nwb
nwb copied to clipboard
index.jsx
This issue is a: Feature request
Could you let us use index.jsx instead of index.js for react components???
@insin I would go a bit further than that and make the default entry point just 'src/index'.
Why? Simple - we use nwb in TypeScript environment, and have an src/index.tsx
. I envision someone could have src/index.ts
instead, and hardcoding all of that just doesn't make any sense. Maybe at some point people will start embracing esm
extension. Just let webpack handle it, hardcoded extensions make it harder.
Any update on this? I would like to use the extension .jsx
for all React components but I want to avoid have to override the webpack rules and resolve configuration.
Update - change of plans In case someone else wants to do the same, the config below can save you a couple of minutes.
const { resolve } = require('path');
module.exports = {
type: 'react-app',
webpack: {
rules: {
babel: {
test: /\.jsx?/,
},
},
extra: {
entry: resolve(__dirname, 'src'),
resolve: {
extensions: ['.js', '.jsx'],
},
},
},
};
Update - change of plans In case someone else wants to do the same, the config below can save you a couple of minutes.
thanks a lot!!