Closed lin-mt closed 1 year ago
Describe the bug 在开发时需要引入一个插件,我将该插件按照以下方式在 .storybook/main.js 中定义使用:
.storybook/main.js
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); module.exports = { // ... webpackFinal: (config) => { // ... if (!config.plugins) { config.plugins = []; } config.plugins.push(new MonacoWebpackPlugin()); return config; }, };
在开发时,该插件正常生效,打包发布后,该插件无效,目前尝试了在 .config/webpack.config.js 中使用该插件,依然无效:
.config/webpack.config.js
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); const finalConfig = merge(config, { output: { // ... }, plugins: [new MonacoWebpackPlugin()] });
To Reproduce Steps to reproduce the behavior:
Expected behavior 插件正常生效
Screenshots
Desktop (please complete the following information):
Additional context Add any other context about the problem here.
Webpack 只对 /dist/index.min.js 产物生效,具体构建分工可以看 这里。如果是物料本身依赖了这个 Webpack 插件,我认为应该是由物料的使用方来额外配置插件?
/dist/index.min.js
应该是吧,已经换了另一种方式实现了~谢谢!
Describe the bug 在开发时需要引入一个插件,我将该插件按照以下方式在
.storybook/main.js
中定义使用:在开发时,该插件正常生效,打包发布后,该插件无效,目前尝试了在
.config/webpack.config.js
中使用该插件,依然无效:To Reproduce Steps to reproduce the behavior:
Expected behavior 插件正常生效
Screenshots
Desktop (please complete the following information):
Additional context Add any other context about the problem here.