Skip to content

Commit

Permalink
revert happypack because it can not improve stylus hot-reload perform…
Browse files Browse the repository at this point in the history
…ance
  • Loading branch information
Javey committed Jul 26, 2019
1 parent 2763824 commit 9a5cb7d
Showing 1 changed file with 62 additions and 145 deletions.
207 changes: 62 additions & 145 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const Path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const HappyPack = require('happypack');

const resolve = (path) => Path.resolve(__dirname, path);

Expand Down Expand Up @@ -31,85 +30,80 @@ module.exports = {
resolve('../src'),
resolve('../node_modules/kpc-demo'),
],
use: 'happypack/loader?id=js',
// use: [
// {
// loader: 'babel-loader',
// options: {
// cacheDirectory: true,
// }
// }
// ]
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
}
}
]
},
{
test: /\.vdt$/,
use: 'happypack/loader?id=vdt',
// use: [
// {
// loader: 'babel-loader',
// options: {
// cacheDirectory: true,
// }
// },
// {
// loader: 'vdt-loader',
// options: {
// delimiters: ['{{', '}}'],
// skipWhitespace: true,
// }
// }
// ]
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
}
},
{
loader: 'vdt-loader',
options: {
delimiters: ['{{', '}}'],
skipWhitespace: true,
}
}
]
},
{
test: /\.styl$/,
use: 'happypack/loader?id=styl',
// use: [
// {
// loader: 'style-loader',
// },
// {
// loader: 'css-loader',
// options: {
// url: true,
// }
// },
// {
// loader: 'stylus-loader',
// options: {
// 'include css': true,
// 'resolve url': true,
// sourceMap: false,
// 'import': resolve('../src/theme/index.styl'),
// }
// }
// ]
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
url: true,
}
},
{
loader: 'stylus-loader',
options: {
'include css': true,
'resolve url': true,
sourceMap: false,
'import': resolve('../src/theme/index.styl'),
}
}
]
},
{
test: /\.css$/,
use: 'happypack/loader?id=css',
// use: [
// {
// loader: 'style-loader',
// },
// {
// loader: 'css-loader',
// options: {
// url: true
// }
// }
// ]
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
url: true
}
}
]
},
{
test: /\.(woff2?|eot|ttf|otf|svg|png)(\?.*)?$/,
use: 'happypack/loader?id=file',
// use: [
// {
// loader: 'file-loader',
// options: {
// outputPath: 'static/media/',
// }
// }
// ]
use: [
{
loader: 'file-loader',
options: {
outputPath: 'static/media/',
}
}
]
},
]
},
Expand All @@ -118,83 +112,6 @@ module.exports = {
inject: true,
template: resolve('../public/index.html'),
}),
new HappyPack({
id: 'js',
loaders: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
}
}
]
}),
new HappyPack({
id: 'vdt',
loaders: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
}
},
{
loader: 'vdt-loader',
options: {
delimiters: ['{{', '}}'],
skipWhitespace: true,
}
}
]
}),
new HappyPack({
id: 'styl',
loaders: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
url: true,
}
},
{
loader: 'stylus-loader',
options: {
'include css': true,
'resolve url': true,
sourceMap: false,
'import': resolve('../src/theme/index.styl'),
}
}
]
}),
new HappyPack({
id: 'css',
loaders: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
url: true
}
}
]
}),
new HappyPack({
id: 'file',
loaders: [
{
loader: 'file-loader',
options: {
outputPath: 'static/media/',
}
}
]
}),
],
devServer: {
port: 5678,
Expand Down

0 comments on commit 9a5cb7d

Please sign in to comment.