We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug描述 在chameleon.config.js中按文档 设置webpack noParse 配置无效。
复现bug的步骤
问题截图 chameleon.config.js中:
// 原始文件中的require
// 生成的static/js/common.js中还是会处理noParse设置的require
编译环境信息
运行环境信息
The text was updated successfully, but these errors were encountered:
webpack关于 noParse的解释 module.noParse 防止 webpack 解析那些任何与给定正则表达式相匹配的文件。忽略的文件中不应该含有 import, require, define 的调用,或任何其他导入机制。忽略大型的 library 可以提高构建性能。
cml.utils.plugin('webpackConfig', function({ type, media, webpackConfig }, cb) { // cb函数用于设置修改后的配置 webpackConfig.module.noParse = function(content){ return /test-noparse/.test(content) //测试工程化配置 noParse是否生效 } cb({ type, media, webpackConfig }); });
import './test-noparse.js'
这里我简单加了一个测试案例:test-noparse.js 文件引用的 m1.js 文件,
test-noparse.js
console.log('no-parse'); const m1 = require('./m1.js')
m1.js
module.exports = { name:"module1" }
/***/ "./src/pages/index/test-noparse.js": /***/ (function(module, exports) { console.log('no-parse'); var m1 = require('./m1.js'); /***/ }),
全部demo参见:https://github.com/chameleon-team/cml-web-multipage
webpackConfig.module.noParse = function(content){ // return /test-noparse/.test(content) //测试工程化配置 noParse是否生效 }
查看构建后代码
/***/ "./src/pages/index/test-noparse.js": /***/ (function(module, exports, __webpack_require__) { console.log('no-parse'); var m1 = __webpack_require__("./src/pages/index/m1.js"); /***/ }),
Sorry, something went wrong.
No branches or pull requests
bug描述
在chameleon.config.js中按文档 设置webpack noParse 配置无效。
复现bug的步骤
问题截图
chameleon.config.js中:
// 原始文件中的require
// 生成的static/js/common.js中还是会处理noParse设置的require
编译环境信息
运行环境信息
The text was updated successfully, but these errors were encountered: