mirror of
https://github.com/d3ward/toolz.git
synced 2024-09-20 06:46:16 +08:00
Fix webpack
This commit is contained in:
parent
f24186ff0e
commit
2dd83f51e0
|
@ -6,11 +6,13 @@ module.exports = merge(main, {
|
|||
mode: 'development',
|
||||
devServer: {
|
||||
static: {
|
||||
directory: config.dist
|
||||
directory: config.dist,
|
||||
publicPath: '/'
|
||||
},
|
||||
compress: true,
|
||||
port: 3000,
|
||||
hot: true,
|
||||
open: true
|
||||
open: '/toolz/',
|
||||
historyApiFallback: true
|
||||
}
|
||||
})
|
||||
|
|
|
@ -3,6 +3,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||
const config = require('./config')
|
||||
const pages = config.pages
|
||||
|
||||
module.exports = {
|
||||
context: config.src,
|
||||
entry: {
|
||||
|
@ -12,10 +13,11 @@ module.exports = {
|
|||
}, {})
|
||||
},
|
||||
output: {
|
||||
filename: './js/[name].js',
|
||||
filename: 'js/[name].js',
|
||||
path: config.build,
|
||||
clean: false,
|
||||
assetModuleFilename: '[path][name][ext]'
|
||||
assetModuleFilename: '[path][name][ext]',
|
||||
publicPath: '/toolz/'
|
||||
},
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({
|
||||
|
@ -36,7 +38,7 @@ module.exports = {
|
|||
]
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: './css/[name].css',
|
||||
filename: 'css/[name].css',
|
||||
chunkFilename: '[name].css'
|
||||
}),
|
||||
...pages.map(
|
||||
|
@ -60,7 +62,6 @@ module.exports = {
|
|||
test: /\.ejs$/i,
|
||||
use: ['html-loader', 'template-ejs-loader']
|
||||
},
|
||||
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
|
@ -69,9 +70,9 @@ module.exports = {
|
|||
{
|
||||
test: /\.(sa|sc|c)ss$/,
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader, // extract css from commonjs
|
||||
'css-loader', // turn css into commonjs
|
||||
'sass-loader' // turn scss into css
|
||||
MiniCssExtractPlugin.loader, // Extract CSS from commonjs
|
||||
'css-loader', // Turn css into commonjs
|
||||
'sass-loader' // Turn scss into css
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -5,7 +5,6 @@ const TerserPlugin = require('terser-webpack-plugin')
|
|||
|
||||
module.exports = merge(main, {
|
||||
mode: 'production',
|
||||
publicPath: '/toolz/',
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
|
|
Loading…
Reference in a new issue