You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
整个编译都没有问题,但是等到webpack跑到99%的时候会报错,
报
error in ./src/pages/XXX/xxxx/index.tsx
Module parse failed: Unexpected token(19:45)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. see https://webpack.js.org/concepts#loaders
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
我现在项目pages里面的页面很多,编译时间很长,想就需要的页面进行编译。查了很多地方,了解下来的方案是通过config.ts里面的chainWebpack去解决,通过增加exclude去做。我的配置如下:
chainWebpack(config:any){
const excludes=[
"src/pages/XXX",
"src/pages/YYY",
]
excludes.forEach((rule)=>{
const rulePath = path.resolve(__dirname,'../"+rule)
config.module.rule('ts').exclude.add(rulePath)
config.module.rule('tsx').exclude.add(rulePath)
config.module.rule('js').exclude.add(rulePath)
config.module.rule('less').exclude.add(rulePath)
})
}
整个编译都没有问题,但是等到webpack跑到99%的时候会报错,
报
error in ./src/pages/XXX/xxxx/index.tsx
Module parse failed: Unexpected token(19:45)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. see https://webpack.js.org/concepts#loaders
请问有什么解决办法吗?
All reactions