2020-05-07 19:34:28 +00:00
|
|
|
import resolve from '@rollup/plugin-node-resolve'
|
|
|
|
import commonjs from '@rollup/plugin-commonjs'
|
2020-05-08 19:42:36 +00:00
|
|
|
import replace from '@rollup/plugin-replace'
|
2020-05-22 20:59:16 +00:00
|
|
|
import alias from '@rollup/plugin-alias'
|
2020-06-03 16:31:38 +00:00
|
|
|
import analyze from 'rollup-plugin-analyzer'
|
2020-06-22 20:05:19 +00:00
|
|
|
import vue from 'rollup-plugin-vue'
|
2020-07-18 20:44:27 +00:00
|
|
|
import svg from 'rollup-plugin-svg'
|
2020-10-09 18:53:24 +00:00
|
|
|
import postcss from 'rollup-plugin-postcss'
|
2020-11-11 08:29:18 +00:00
|
|
|
|
2020-11-08 22:35:46 +00:00
|
|
|
import { version } from './package.json'
|
2020-05-07 19:34:28 +00:00
|
|
|
|
2020-11-04 19:51:14 +00:00
|
|
|
const isProduction = !process.env.ROLLUP_WATCH
|
|
|
|
process.env.NODE_ENV = isProduction ? 'production' : 'development'
|
2020-05-07 19:34:28 +00:00
|
|
|
|
|
|
|
export default {
|
2020-07-16 22:11:28 +00:00
|
|
|
input: 'src/app.js',
|
2020-05-07 19:34:28 +00:00
|
|
|
output: [
|
|
|
|
{
|
2020-11-11 08:29:18 +00:00
|
|
|
file: isProduction ? 'public/js/bundle.temp.js' : 'public/js/bundle.js',
|
2020-05-07 19:34:28 +00:00
|
|
|
format: 'module',
|
2020-11-04 19:51:14 +00:00
|
|
|
sourcemap: !isProduction
|
2020-05-07 19:34:28 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
plugins: [
|
2020-05-22 20:59:16 +00:00
|
|
|
alias({
|
|
|
|
entries: [
|
|
|
|
{
|
|
|
|
find: 'vue',
|
|
|
|
replacement: 'vue/dist/vue.esm'
|
2020-06-24 17:10:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
find: '@',
|
|
|
|
replacement: __dirname + '/src'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: '@components',
|
2020-07-16 22:11:28 +00:00
|
|
|
replacement: __dirname + '/src/components'
|
2020-05-22 20:59:16 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
// Needed for Vue imports
|
2020-05-08 19:42:36 +00:00
|
|
|
replace({
|
2021-08-09 16:33:31 +00:00
|
|
|
preventAssignment: true,
|
|
|
|
values: {
|
|
|
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
|
|
|
__VER__: JSON.stringify(version)
|
|
|
|
}
|
2020-05-08 19:42:36 +00:00
|
|
|
}),
|
2020-05-07 19:34:28 +00:00
|
|
|
resolve(), // Tells Rollup how to find imported modules in node_modules
|
|
|
|
commonjs(), // Converts imported modules to ES modules, if necessary
|
2020-07-18 20:44:27 +00:00
|
|
|
svg(),
|
2020-06-22 20:05:19 +00:00
|
|
|
vue(),
|
2020-10-10 15:35:04 +00:00
|
|
|
postcss(),
|
2020-11-11 08:29:18 +00:00
|
|
|
isProduction && analyze({ summaryOnly: true, limit: 15 }) // Show useful information about bundles, only in production
|
2020-05-07 19:34:28 +00:00
|
|
|
]
|
|
|
|
}
|