Update project
This commit is contained in:
parent
bcbf4224c2
commit
fd64d9491d
16 changed files with 311 additions and 99 deletions
|
|
@ -6,9 +6,6 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|||
const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
|
||||
const Sass = require('sass');
|
||||
|
||||
const isProduction = process.env.NODE_ENV == 'production';
|
||||
const isDevelopment = !isProduction;
|
||||
|
||||
const PATHS = {
|
||||
entryPoint: path.resolve(__dirname, 'src/index.ts'),
|
||||
bundles: path.resolve(__dirname, 'dist'),
|
||||
|
|
@ -23,7 +20,7 @@ module.exports = {
|
|||
filename: '[name].[contenthash].js',
|
||||
path: PATHS.bundles,
|
||||
},
|
||||
devtool: isDevelopment ? 'source-map' : 'null',
|
||||
devtool: 'source-map',
|
||||
watchOptions: {
|
||||
aggregateTimeout: 600,
|
||||
ignored: /node_modules/,
|
||||
|
|
@ -34,10 +31,11 @@ module.exports = {
|
|||
},
|
||||
optimization: {
|
||||
minimize: true,
|
||||
usedExports: true,
|
||||
minimizer: [
|
||||
new TerserJSPlugin({
|
||||
sourceMap: true,
|
||||
test: /\.js$/i,
|
||||
test: /\.js$/,
|
||||
}),
|
||||
new OptimizeCSSAssetsPlugin({}),
|
||||
],
|
||||
|
|
@ -65,7 +63,7 @@ module.exports = {
|
|||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.scss$/i,
|
||||
test: /\.scss$/,
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
'css-loader',
|
||||
|
|
@ -93,15 +91,7 @@ module.exports = {
|
|||
exclude: /node_modules/,
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
loader: 'svg-url-loader',
|
||||
options: {
|
||||
limit: 10 * 1024,
|
||||
noquotes: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.(ico|png|jpg)$/i,
|
||||
test: /\.(ico|png|jpg)$/,
|
||||
use: {
|
||||
loader: 'file-loader',
|
||||
query: {
|
||||
|
|
@ -110,6 +100,16 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.(svg)$/,
|
||||
use: {
|
||||
loader: 'file-loader',
|
||||
query: {
|
||||
outputPath: '/static',
|
||||
name: '[name].[ext]',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
enforce: 'pre',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue