Comments (5)
I don't know what happened to it. Can you help me look at it
from happypack.
Can you list your Webpack version and the config?
from happypack.
[email protected]
"happypack": "^5.0.1",
use vue-cli4
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJsPlugin = require('terser-webpack-plugin');
const HtmlWebpackTagsPlugin = require('html-webpack-tags-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const HappyPack = require('happypack')
const os = require('os')
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const chalk = require('chalk');
const happyThreadPool = HappyPack.ThreadPool({ size: os.cpus().length })
const isProd = process.env.NODE_ENV === 'production';
module.exports = {
publicPath: isProd ? ' ./' : '/',
devServer: {
},
configureWebpack: config => {
config.module.unknownContextCritical = false;
config.resolve.alias = {
'@': path.resolve(__dirname, 'src'),
C: path.resolve(__dirname, 'src/components'),
S: path.resolve(__dirname, 'src/service'),
U: path.resolve(__dirname, 'src/utils'),
};
config.entry = isProd
? {
customSource: './src/CustomSource/CustomSource.js',
app: './src/main.js',
}
: {
Cesium: './ThirdParty/CesiumSource.js',
customSource: './src/CustomSource/CustomSource.js',
app: './src/main.js',
};
config.plugins.push(
new webpack.DefinePlugin({
CESIUM_BASE_URL: JSON.stringify('./Cesium/')
}),
new CopyWebpackPlugin([
{
from: './node_modules/cesium/Build/Cesium',
to: 'Cesium',
},
]),
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
}),
new HappyPack({
id: 'happyBabel',
loaders: [{
loader: 'babel-loader?cacheDirectory=true',
}],
threadPool: happyThreadPool,
verbose: true,
})
);
if (isProd) {
config.module.rules.push({
test: /\.js$/,
loader: 'happypack/loader?id=happyBabel',
exclude: /node_modules/
});
// 为生产环境修改配置...
config.optimization = {
minimizer: [
new UglifyJsPlugin({
terserOptions: {
warnings: false,
compress: {
drop_debugger: true,
drop_console: true,
pure_funcs: ['console.log'],
},
output: {
comments: false,
},
},
sourceMap: false,
parallel: true,
}),
],
splitChunks: {
chunks: 'all',
minSize: 300000,
maxSize: 10000000,
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/, // 匹配node_modules目录下的文件
priority: -10, // 优先级配置项
},
default: {
minChunks: 2,
priority: -20, // 优先级配置项
reuseExistingChunk: true,
},
},
},
};
config.plugins.push(
new HtmlWebpackPlugin({
filename: './index.html',
template: './public/index.html',
}),
new HtmlWebpackTagsPlugin({
append: false,
scripts: 'Cesium/Cesium.js',
}),
new HtmlWebpackTagsPlugin({
append: false,
links: 'Cesium/Widgets/widgets.css',
}),
// new BundleAnalyzerPlugin(),
new CompressionPlugin({
filename: '[path].gz[query]',
algorithm: 'gzip',
test: /\.js$|\.css$|\.html$/,
threshold: 102400,
minRatio: 0.8,
deleteOriginalAssets: true,
}),
// new HappyPack({
// // 3) re-add the loaders you replaced above in #1:
// loaders: [ 'babel-loader?presets[]=es2015' ],
// threadPool: happyThreadPool,
// id: 'babel'
// }),
// new HappyPack({
// //用id来标识 happypack处理那里类文件
// id: 'happyBabel',
// //如何处理 用法和loader 的配置一样
// loaders: [{
// loader: 'babel-loader?cacheDirectory=true',
// }],
// //共享进程池
// threadPool: happyThreadPool,
// //允许 HappyPack 输出日志
// verbose: true,
// }),
new ProgressBarPlugin({
format: ' build [:bar] ' + chalk.green.bold(':percent') + ' (:elapsed seconds)',
clear: false
})
);
} else {
// 为开发环境修改配置...
config.devtool = 'eval-source-map';
config.plugins.push(
new HtmlWebpackPlugin({
filename: './index.html',
template: './public/index.html',
}),
new HtmlWebpackTagsPlugin({
append: false,
links: './Cesium/Widgets/widgets.css',
})
);
}
},
chainWebpack: config => {
const oneOfsMap = config.module.rule('scss').oneOfs.store;
oneOfsMap.forEach(item => {
item.use('sass-resources-loader')
.loader('sass-resources-loader')
.options({
resources: './src/style/public.scss',
})
.end();
});
config
.plugin('webpack-bundle-nalyzer')
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin);
return config;
},
};
from happypack.
Can you list your Webpack version and the config?
Is it a version issue?
from happypack.
Has the problem been solved?
from happypack.
Related Issues (20)
- It works in CSS, but it doesn't work in Babel HOT 2
- webpack4 is more slower?
- How do you remove the happypack cache? HOT 5
- The translation of thread and process
- can't resolve module "happypack/loader"
- not support SASS-LOADER implementation HOT 4
- [email protected] new webpack api support request
- Channel closed HOT 2
- happypack and scoped/postcss-loader conflict?
- Non-deterministic build output when used with ts-loader
- customized babel plugin throw an error
- Cannot read property 'normal' of undefined HOT 5
- Example references missing example-utils repo
- How to use in webpack-chain
- Happypack v5.0.0 breaking emoji-mart v3.0.0
- build error HOT 2
- Happypack semver issue
- Loaded 0 entries from cache. (0 were stale)
- Why not give it a more specific name, such as multi-thread-pack? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from happypack.