nwb icon indicating copy to clipboard operation
nwb copied to clipboard

index.jsx

Open clayrisser opened this issue 7 years ago • 3 comments

This issue is a: Feature request

Could you let us use index.jsx instead of index.js for react components???

clayrisser avatar Jul 01 '17 23:07 clayrisser

@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.

DethAriel avatar Jul 27 '17 21:07 DethAriel

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'],
      },
    },
  },
};

lcdss avatar Mar 20 '20 00:03 lcdss

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!!

IgorSushko1 avatar Jul 01 '20 06:07 IgorSushko1