You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use webpack-parallel-uglify-plugin and echarts,I got a error:
main.js:1 Uncaught Error: axisPointer CartesianAxisPointer exists
at Function.a.registerAxisPointerClass (vendor.js:1)
at Object.install (vendor.js:1)
at t (vendor.js:1)
at Object.install (vendor.js:1)
at t (vendor.js:1)
at Module../node_modules/echarts/index.js (vendor.js:1)
at w (main.js:1)
at e (main.js:1)
at Module../src/index.ts (main.js:1)
at w (main.js:1)
After comparison and investigation,I found webpack-parallel-uglify-plugin cause the error.
When I use webpack-parallel-uglify-plugin and echarts,I got a error:
main.js:1 Uncaught Error: axisPointer CartesianAxisPointer exists
at Function.a.registerAxisPointerClass (vendor.js:1)
at Object.install (vendor.js:1)
at t (vendor.js:1)
at Object.install (vendor.js:1)
at t (vendor.js:1)
at Module../node_modules/echarts/index.js (vendor.js:1)
at w (main.js:1)
at e (main.js:1)
at Module../src/index.ts (main.js:1)
at w (main.js:1)
After comparison and investigation,I found webpack-parallel-uglify-plugin cause the error.
versions:
"echarts": "^5.2.2",
"webpack-parallel-uglify-plugin": "^2.0.0",
webpack.config.js:
const HtmlWebpackPlugin = require('html-webpack-plugin');
const BundleAnalyzerPlugin =
require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const path = require('path');
const HappyPack = require('happypack');
const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin');
module.exports = {
entry: path.resolve(__dirname, 'src', 'index.ts'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
chunkFilename: '[name].[hash:4].js',
},
resolve: {
extensions: ['.ts', '.js'],
},
optimization: {
// 1. 这个配置必须
minimize: false,
splitChunks: {
cacheGroups: {
default: {
name: 'common',
chunks: 'initial',
minChunks: 2,
priority: -20,
},
vendors: {
test: /[\/]node_modules[\/]/,
name: 'vendor',
chunks: 'initial',
priority: -10,
},
},
},
},
devtool: 'cheap-source-map',
module: {
rules: [
{
test: /.css$/,
use: ['happypack/loader?id=css'],
// use: ['style-loader', 'css-loader'],
},
{
test: /.(ts|js)$/,
use: ['happypack/loader?id=babel'],
// loader: 'babel-loader',
exclude: [path.join(__dirname, 'node_modules')],
// options: {
// presets: ['@babel/preset-env', '@babel/typescript'],
// },
},
],
},
devServer: {
port: 'auto',
client: {
reconnect: 5,
progress: true,
},
hot: true,
static: path.resolve(__dirname, 'dist/index.html'),
},
plugins: [
new BundleAnalyzerPlugin(),
new ParallelUglifyPlugin({
uglifyJS: {
// output: {
// beautify: false,
// comments: false,
// },
// warnings: false,
// compress: {
// drop_console: true,
// collapse_vars: true,
// reduce_vars: true,
// },
},
}),
new HappyPack({
id: 'babel',
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/typescript'],
},
},
],
}),
new HappyPack({
id: 'css',
loaders: ['style-loader', 'css-loader'],
}),
new HtmlWebpackPlugin({
title: 'TypeScript Learner',
filename: path.resolve(__dirname, 'dist', 'index.html'),
template: path.resolve(__dirname, 'public', 'index.html'),
}),
],
};
The text was updated successfully, but these errors were encountered: