forked from go/golangs_learn
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.
63 lines
1.2 KiB
63 lines
1.2 KiB
3 years ago
|
|
||
|
|
||
|
let cssConfig = {};
|
||
|
|
||
|
if (process.env.NODE_ENV == "production") {
|
||
|
cssConfig = {
|
||
|
extract: {
|
||
|
filename: "[name].css",
|
||
|
chunkFilename: "[name].css"
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
const path = require('path')
|
||
|
const PrerenderSPAPlugin = require('prerender-spa-plugin')
|
||
|
|
||
|
module.exports = {
|
||
|
plugins: [
|
||
|
new PrerenderSPAPlugin({
|
||
|
// Required - The path to the webpack-outputted app to prerender.
|
||
|
staticDir: path.join(__dirname, 'dist'),
|
||
|
// Required - Routes to render.
|
||
|
routes: [ '/', '/login', '/dashboard' ],
|
||
|
})
|
||
|
]
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
chainWebpack: config => {
|
||
|
let limit = 9999999999999999;
|
||
|
config.module
|
||
|
.rule("images")
|
||
|
.test(/\.(png|gif|jpg|jpeg)(\?.*)?$/i)
|
||
|
.use("url-loader")
|
||
|
.loader("url-loader")
|
||
|
.tap(options => Object.assign(options, { limit: limit }));
|
||
|
config.module
|
||
|
.rule("fonts")
|
||
|
.test(/\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/i)
|
||
|
.use("url-loader")
|
||
|
.loader("url-loader")
|
||
|
.options({
|
||
|
limit: limit
|
||
|
});
|
||
|
},
|
||
|
css: cssConfig,
|
||
|
configureWebpack: {
|
||
|
output: {
|
||
|
filename: "[name].js"
|
||
|
},
|
||
|
optimization: {
|
||
|
splitChunks: false
|
||
|
}
|
||
|
},
|
||
|
devServer: {
|
||
|
disableHostCheck: true,
|
||
|
host: "localhost"
|
||
|
}
|
||
|
};
|
||
|
|
||
|
|
||
|
|