1 Star 0 Fork 1

klose/ant-design-charts

forked from ayiaq1/ant-design-charts 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 3.18 KB
一键复制 编辑 原始数据 按行查看 历史
阿福 提交于 2021-03-08 10:48 +08:00 . fix: 兼容 ie9 (#522)
const webpack = require('webpack');
const fs = require('fs');
const path = require('path');
const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath);
process.env.NODE_ENV = 'production';
module.exports = {
entry: {
// charts: ['@babel/polyfill', './src/index.ts'],
charts: './src/index.charts.ts',
charts_g6: './src/index.g6.ts',
},
output: {
filename: '[name].min.js',
library: '[name]',
libraryTarget: 'umd',
path: resolveApp('dist/'),
},
resolve: {
mainFields: ['module', 'main'],
extensions: ['.ts', '.tsx', '.js'],
modules: ['node_modules'],
},
externals: {
react: 'React',
'react-dom': 'ReactDOM',
},
module: {
rules: [
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
include: [path.resolve('src')],
loader: require.resolve('babel-loader'),
options: {
customize: require.resolve('babel-preset-react-app/webpack-overrides'),
presets: [
[
require.resolve('babel-preset-react-app'),
{
runtime: 'classic',
},
],
],
plugins: [
[
require.resolve('babel-plugin-named-asset-import'),
{
loaderMap: {
svg: {
ReactComponent: '@svgr/webpack?-svgo,+titleProp,+ref![path]',
},
},
},
],
].filter(Boolean),
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
// See #6846 for context on why cacheCompression is disabled
cacheCompression: false,
compact: true,
},
},
{
test: /\.(js|mjs)$/,
exclude: /@babel(?:\/|\\{1,2})runtime/,
loader: require.resolve('babel-loader'),
options: {
babelrc: false,
configFile: false,
compact: false,
presets: [[require.resolve('babel-preset-react-app/dependencies'), { helpers: true }]],
cacheDirectory: true,
// See #6846 for context on why cacheCompression is disabled
cacheCompression: false,
// Babel sourcemaps are needed for debugging into node_modules
// code. Without the options below, debuggers like VSCode
// show incorrect code and set breakpoints on the wrong lines.
sourceMaps: true,
inputSourceMap: true,
},
},
],
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new ForkTsCheckerWebpackPlugin({
eslint: undefined,
}),
new webpack.optimize.AggressiveMergingPlugin(),
...(process.env.MODE === 'ANALYZER'
? [new BundleAnalyzerPlugin({ analyzerMode: 'static' })]
: []),
],
performance: {
hints: false,
},
devtool: 'source-map',
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/klose/ant-design-charts.git
git@gitee.com:klose/ant-design-charts.git
klose
ant-design-charts
ant-design-charts
master

搜索帮助