[英]how can I exclude some folders containing .vue files from being built in vuejs?
module.exports = { presets: [ '@vue/app' ], module:{ rules: [ { test: /\.vue$/, exclude: [ './src/components/Homepages/number1', './src/components/Homepages/number2' ] } ] } }
I am trying to include just one of 'Homepages/number1', 'Homepages/number2', 'Homepages/number3' folders in my project conditionally and others shoud be excluded from the project when running npm run build to decrease my dist folder size.
我试图在我的项目中有条件地仅包含“Homepages/number1”、“Homepages/number2”、“Homepages/number3”文件夹中的一个,并且在运行npm 运行构建以减小我的dist文件夹大小时,应将其他文件夹排除在项目之外。 I am trying this code but I am sure its not the right solution.
我正在尝试这段代码,但我确信它不是正确的解决方案。 I am doing this config in babel.config.js.
我在 babel.config.js 中做这个配置。
One option is to use the Copy plugin :一种选择是使用Copy 插件:
module.exports = {
plugins: [
new CopyPlugin({
patterns: [
{
from: path.posix.join(
path.resolve(__dirname, "src").replace(/\\/g, "/"),
"**/*"
),
globOptions: {
ignore: [
// Ignore all `txt` files
"**/*.txt",
// Ignore all files in all subdirectories
"**/subdir/**",
],
},
},
],
}),
],
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.