Replies: 2 comments 9 replies
-
source.exclude 的作用是「跳过编译」而不是「跳过打包」,如果需要跳过打包,可以使用 externals 配置 |
Beta Was this translation helpful? Give feedback.
1 reply
-
@NieShiyi 听起来你是希望在使用 modern.js 约定式路由的时候,排除掉 routes/ 下的某个页面,不生成该页面? |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
我采用的Menorepo和约定式路由组织项目,我希望在打包的时候通过source.exclude这个参数不要把我的一个文件见打包进去。
使用方式:在apps的项目下的modern.config.js中引用如下
···
import { defineConfig, appTools } from '@modern-js/app-tools';
import path from 'path';
module.exports = {
runtime: {
router: true,
state: true,
},
html: {
disableHtmlFolder: true,
title: 'bio',
},
source: {
mainEntryName: 'index',
exclude: [/src/routes/__home/blog/],
// exclude: [path.resolve(__dirname, 'src/routes/newcrown')],
},
output: {
distPath: {
html: '',
js: '',
css: '',
},
},
tools: {
devServer: {
proxy: {
'/api': {
target: 'http://xxxx/',
changeOrigin: true,
pathRewrite: { '^/api': '' },
},
},
},
},
server: {
ssr: false,
port: 8099,
},
plugins: [appTools()],
};
···
爆错误如下:
这个文件夹下面的页面报错
Module parse failed: Unexpected token (20:9)
File was processed with these loaders:
You may need an additional loader to handle the result of these loaders.‘
Beta Was this translation helpful? Give feedback.
All reactions