Webpack 默认包含 AMDPlugin,因此如果模块在 CommonJS 之前检查 AMD,则将使用该模块定义。
if (typeof define === 'function' && define.amd) {
define([], factory)
} else if (typeof exports === 'object') {
exports.foo = factory();
}
我想完全忽略 AMD。有没有办法在 webpack 中做到这一点?
最佳答案
也可以考虑 script-loader
,如 Shimming documentation 末尾所述:
The script-loader evaluates code in the global context, similar to inclusion via a script tag. In this mode, every normal library should work. require, module, etc. are undefined.
关于webpack - 有没有办法禁用 AMDPlugin?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29302742/