59 lines
1.9 KiB
JavaScript
59 lines
1.9 KiB
JavaScript
import typescript from "@rollup/plugin-typescript";
|
|
import json from "@rollup/plugin-json";
|
|
import html from "rollup-plugin-string-html";
|
|
import resolve from "@rollup/plugin-node-resolve";
|
|
import replace from "@rollup/plugin-replace";
|
|
import alias from "@rollup/plugin-alias";
|
|
import postcss from 'rollup-plugin-postcss';
|
|
import vue from "@vitejs/plugin-vue";
|
|
|
|
let node_env = process.env.NODE_ENV;
|
|
let vuePath = node_env === 'production' ?
|
|
'vue/dist/vue.runtime.esm-browser.prod.js' : 'vue/dist/vue.runtime.esm-browser.js';
|
|
export default {
|
|
// input: 'src/ts/index.ts',
|
|
input: 'src/ts/class/Application.ts',
|
|
output: {
|
|
file: 'dist/bundle.js',
|
|
format: 'iife',
|
|
name: 'bundle.js',
|
|
},
|
|
plugins: [
|
|
json(),
|
|
alias({
|
|
entries: [{ find: 'vue', replacement: vuePath }]
|
|
}),
|
|
replace({
|
|
values: {
|
|
'process.env.NODE_ENV': () => JSON.stringify(node_env),
|
|
'__VUE_OPTIONS_API__': () => JSON.stringify(false),
|
|
'__VUE_PROD_DEVTOOLS__': () => JSON.stringify(true),
|
|
},
|
|
preventAssignment: true,
|
|
}),
|
|
vue({ isProduction: node_env === 'production' }),
|
|
postcss({ minimize: true }),
|
|
resolve({
|
|
browser: true,
|
|
preferBuiltins: false,
|
|
}),
|
|
typescript(),
|
|
html({
|
|
// include: ["**/*.html", "**/*.css"],
|
|
include: ["**/*.html"],
|
|
minifier: {
|
|
includeAutoGeneratedTags: true,
|
|
removeAttributeQuotes: false,
|
|
removeComments: true,
|
|
removeRedundantAttributes: false,
|
|
removeScriptTypeAttributes: true,
|
|
removeStyleLinkTypeAttributes: true,
|
|
sortClassName: true,
|
|
useShortDoctype: true,
|
|
collapseWhitespace: true,
|
|
minifyCSS: true,
|
|
}
|
|
}),
|
|
],
|
|
};
|