Closed chuans closed 6 years ago
tsx 需要显示加入到 webpack 的 resolve.extendsions 里面
同样的问题,按照你说的我加了extensions, 会报 you may need an appropriate loader to handle this file type. 下面是我的webpack.config.js的配置
module.exports = {
egg: true,
framework: 'react',
// devtool: 'source-map',
entry: {
include: [
'app/web/page',
{ 'spa/redux': 'app/web/page/spa/redux.jsx?loader=false' },
{ 'spa/client': 'app/web/page/spa/client.jsx?loader=false' },
{ 'spa/ssr': 'app/web/page/spa/ssr.jsx?loader=false' }
],
loader: {
client: 'app/web/framework/entry/client-loader.js',
// server: 'app/web/framework/entry/server-loader.js',
server:'app/web/framework/entry/activity-loader.js'
}
},
alias: {
asset: 'app/web/asset',
component: 'app/web/component',
framework: 'app/web/framework',
config: 'app/config',
store: 'app/web/store',
utils: 'app/web/utils',
blockbucket: 'app/web/blockbucket',
model: 'app/web/model'
},
cssModule: {
include: ['app/web/page/css/module','app/web/blockbucket/modules','app/web/blockbucket/common']
},
dll: ['react', 'react-dom','isomorphic-fetch','babel-polyfill'],
resolve: {
extensions: ['.tsx', '.ts']
},
loaders: {
css: true,
scss: true,
less: true, // 开启less, 默认禁用
stylus: true, // 开启stylus, 默认禁用
typescript: true
},
plugins: {
imagemini: false,
// 添加打包忽略插件===
ignore:{
env: ['prod'],
name: new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
}
},
watchOptions: {
},
done() {
console.log('---webpack compile finish---');
}
};
`
@hubcarl Please Help
nodejs.Error: read webpack memory file[/Users/xxx/Documents/xxx/chasing_the_wind/app/view/index.js] content is empty, please check if the file exists at /Users/xxx/Documents/xxx/chasing_the_wind/node_modules/egg-webpack-react/app.js:20:17 at Generator.next (<anonymous>) at onFulfilled (/Users/chuans/Documents/chuans/chasing_the_wind/node_modules/co/index.js:65:19) at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7)
这个是目前报错的信息,但是我如果吧tsx的后缀改成js或者jsx 一切正常,请问下 这个是什么问题呢