And*_*tin 6 javascript jsx reactjs webpack create-react-app
只是想知道create-react-app如何使用.js文件而不是.jsx用于jsx标记.是因为特殊的webpack配置吗?顺便问一下,在哪里可以找到使用create-react-app创建的项目的webpack和babel配置?
文件扩展名没有什么特别之处; 这只是通过Babel运行的问题.例如:
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader: 'babel',
query: {
presets: [
'react',
'es2015',
'stage-0'
],
plugins: [
["transform-decorators-legacy"],
]
},
}
Run Code Online (Sandbox Code Playgroud)
那将通过Babel和React预设同时运行JS和JSX(以及JS?).
Webpack和Babel配置在create-react-app中.
您可以通过以下方式弹出它
npm run eject 让他们"外化",但只有你真的想要这样做.
https://github.com/facebookincubator/create-react-app#user-content-converting-to-a-custom-setup
| 归档时间: |
|
| 查看次数: |
6730 次 |
| 最近记录: |