用于静态站点的Webpack 4 UMD

时间:2019-05-07 15:00:35

标签: webpack-4 umd

建立外部库时遇到了很大的问题。我可以在开发模式下运行它,但不能在静态模式下构建它。

错误:

universalModuleDefinition:1 Uncaught TypeError: Object(...) is not a function

我的webpack

externals: {
   react: "React",
   "react-dom": "ReactDOM",
   "react-redux": "ReactRedux",
   redux: "Redux",
   "redux-saga": "ReduxSaga",
   "redux-thunk": "ReduxThunk",
   "custom-library": "CustomLibrary",
   "other-library": "OtherLibrary"
},
output: {
   library: "MyLibrary",
   libraryTarget: "umd",
   globalObject: 'this',
   path: path.resolve(__dirname, "../../dist")
},

0 个答案:

没有答案