-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
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
compile.inlcude
不起作用,没发转译 node_modules 下的包
#16024
Comments
手动 patch 了两个文件,解决 diff --git a/node_modules/@tarojs/helper/dist/constants.js b/node_modules/@tarojs/helper/dist/constants.js
index 490a869..926c6c1 100644
--- a/node_modules/@tarojs/helper/dist/constants.js
+++ b/node_modules/@tarojs/helper/dist/constants.js
@@ -96,15 +96,15 @@ exports.processTypeMap = {
};
exports.CSS_EXT = ['.css', '.scss', '.sass', '.less', '.styl', '.stylus', '.wxss', '.acss'];
exports.SCSS_EXT = ['.scss'];
-exports.JS_EXT = ['.js', '.jsx'];
-exports.TS_EXT = ['.ts', '.tsx'];
+exports.JS_EXT = ['.js', '.jsx', '.mjs', '.mjsx'];
+exports.TS_EXT = ['.ts', '.tsx', '.mts', '.mtsx'];
exports.UX_EXT = ['.ux'];
exports.SCRIPT_EXT = exports.JS_EXT.concat(exports.TS_EXT);
exports.VUE_EXT = ['.vue'];
-exports.REG_JS = /\.js(\?.*)?$/;
-exports.REG_SCRIPT = /\.(js|jsx)(\?.*)?$/;
-exports.REG_TYPESCRIPT = /\.(tsx|ts)(\?.*)?$/;
-exports.REG_SCRIPTS = /\.[tj]sx?$/i;
+exports.REG_JS = /\.m?js(\?.*)?$/;
+exports.REG_SCRIPT = /\.m?(js|jsx)(\?.*)?$/;
+exports.REG_TYPESCRIPT = /\.m?(tsx|ts)(\?.*)?$/;
+exports.REG_SCRIPTS = /\.m?[tj]sx?$/i;
exports.REG_VUE = /\.vue$/i;
exports.REG_SASS = /\.(s[ac]ss)$/;
exports.REG_SASS_SASS = /\.sass$/; diff --git a/node_modules/@tarojs/webpack5-runner/dist/webpack/H5WebpackModule.js b/node_modules/@tarojs/webpack5-runner/dist/webpack/H5WebpackModule.js
index 0e42ffb..94e3929 100644
--- a/node_modules/@tarojs/webpack5-runner/dist/webpack/H5WebpackModule.js
+++ b/node_modules/@tarojs/webpack5-runner/dist/webpack/H5WebpackModule.js
@@ -214,10 +214,13 @@ class H5WebpackModule {
if (Array.isArray(compile.include)) {
rule.include.unshift(...compile.include);
}
- rule.exclude = [filename => /@tarojs[\\/]components/.test(filename)];
+ rule.exclude = rule.exclude || [];
if (Array.isArray(compile.exclude)) {
rule.exclude.unshift(...compile.exclude);
}
+
return rule;
}
getMediaRule(staticDirectory) {
|
This was referenced Jul 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
相关平台
H5
浏览器版本: Firefox 128
使用框架: React
复现步骤
compile.include
有以下几个问题:看起来,配置已经加进去了,但没有生效
期望结果
正常应该编译 node_modules 下的目录,并且函数的 include 规则,应该正常工作
实际结果
没法正常工作
环境信息
The text was updated successfully, but these errors were encountered: