mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-14 10:09:31 -07:00
chore(rollup.config.mjs): add rollup configuration file to bundle and transpile TypeScript code
The rollup.config.mjs file is added to the project. This file contains the configuration for Rollup, a module bundler, to bundle and transpile TypeScript code. The configuration includes the input file path, the output directory, the output format, and other options such as source maps and code minification. The resolve plugin is used to resolve module imports, the typescript plugin is used to transpile TypeScript code, and the terser plugin is used to minify the code in production builds. The configuration also checks the BUILD environment variable to conditionally enable code minification in production builds.
This commit is contained in:
29
rollup.config.mjs
Normal file
29
rollup.config.mjs
Normal file
@@ -0,0 +1,29 @@
|
||||
import resolve from '@rollup/plugin-node-resolve'
|
||||
import terser from '@rollup/plugin-terser'
|
||||
import typescript from '@rollup/plugin-typescript'
|
||||
|
||||
export default {
|
||||
input: './assets/ts/main.ts',
|
||||
sourceMap: 'inline',
|
||||
output: {
|
||||
dir: './static/js',
|
||||
format: 'es',
|
||||
chunkFileNames: '[hash:6].js',
|
||||
compact: true
|
||||
},
|
||||
plugins: [
|
||||
resolve({
|
||||
moduleDirectories: ['node_modules']
|
||||
}),
|
||||
typescript({ tsconfig: './tsconfig.json' }),
|
||||
process.env.BUILD === 'production' &&
|
||||
terser({
|
||||
compress: {
|
||||
passes: 3
|
||||
},
|
||||
output: {
|
||||
comments: false
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user