加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 1.70 KB
一键复制 编辑 原始数据 按行查看 历史
Marianne Corvellec 提交于 2020-02-27 18:20 . Resolve merge conflicts
const path = require('path');
const WebpackDashDynamicImport = require('@plotly/webpack-dash-dynamic-import');
const packagejson = require('./package.json');
const dashLibraryName = packagejson.name.replace(/-/g, '_');
module.exports = {
entry: { main: './src/lib/index.js' },
output: {
path: path.resolve(__dirname, dashLibraryName),
chunkFilename: '[name].js',
filename: 'bundle.js',
library: dashLibraryName,
libraryTarget: 'window',
},
externals: {
react: 'React',
'react-dom': 'ReactDOM',
'plotly.js': 'Plotly',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules\/(?!3dmol\/|speck\/|ideogram\/|react-alignment-viewer\/)/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
],
},
],
},
optimization: {
splitChunks: {
name: true,
cacheGroups: {
async: {
chunks: 'async',
minSize: 0,
name(module, chunks, cacheGroupKey) {
return `${cacheGroupKey}-${chunks[0].name}`;
}
}
}
}
},
plugins: [
new WebpackDashDynamicImport()
],
resolve: {
alias: {
'ideogram': 'ideogram/dist/js/ideogram.min.js'
}
}
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化