You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.5 KiB
56 lines
1.5 KiB
4 years ago
|
import pluginNodeResolve from '@rollup/plugin-node-resolve';
|
||
|
import pluginCommonJs from '@rollup/plugin-commonjs';
|
||
|
import { terser } from 'rollup-plugin-terser';
|
||
|
import rollupReplace from '@rollup/plugin-replace';
|
||
|
import pluginAlias from '@rollup/plugin-alias';
|
||
|
import pluginJson from '@rollup/plugin-json';
|
||
|
import pluginVue from 'rollup-plugin-vue';
|
||
|
import pluginScss from 'rollup-plugin-scss';
|
||
|
|
||
|
// `npm run build` -> `production` is true
|
||
|
// `npm run dev` -> `production` is false
|
||
|
const production = !process.env.ROLLUP_WATCH;
|
||
|
|
||
|
export default {
|
||
|
input: 'src/main.js',
|
||
|
output: {
|
||
|
file: 'static/bundle.js',
|
||
|
format: 'iife', // immediately-invoked function expression — suitable for <script> tags
|
||
|
sourcemap: true
|
||
|
},
|
||
|
plugins: [
|
||
|
pluginAlias({
|
||
|
entries: {
|
||
|
//'vue': __dirname + "/node_modules/vue/dist/vue.esm-bundler.js"
|
||
|
}
|
||
|
}),
|
||
|
pluginVue({
|
||
|
target: 'browser',
|
||
|
}),
|
||
|
pluginScss({
|
||
|
output: 'static/style.css',
|
||
|
}),
|
||
|
pluginJson(),
|
||
|
pluginNodeResolve({
|
||
|
jsnext: true,
|
||
|
main: true,
|
||
|
module: true,
|
||
|
browser: true,
|
||
|
preferBuiltins: false,
|
||
|
}),
|
||
|
pluginCommonJs({
|
||
|
include: 'node_modules/**',
|
||
|
browser: true,
|
||
|
preferBuiltins: false,
|
||
|
// ignoreGlobal: false,
|
||
|
sourceMap: !production
|
||
|
}),
|
||
|
rollupReplace({
|
||
|
'process.env.NODE_ENV': production ? '"development"': '"production"',
|
||
|
'__VUE_OPTIONS_API__': 'true',
|
||
|
'__VUE_PROD_DEVTOOLS__': 'false',
|
||
|
}),
|
||
|
production && terser(),
|
||
|
]
|
||
|
};
|