wix-incubator / react-templates

Light weight templates for react
https://wix.github.io/react-templates
MIT License
2.82k stars 207 forks source link

Webpack & ES6 & default react config #232

Open hurano opened 6 years ago

hurano commented 6 years ago

Is there any way we can use the default react webpack config to make react-templates works? https://reactjs.org/docs/installation.html#creating-a-new-application

I would like to modify webpack config after I run this command.

$npm run eject

Thanks.

nippur72 commented 6 years ago

I think it should be as easy as adding the rule in webpack.config.*.js:

rules: 
[
   ...
   { test: /\.rt$/, loader: "react-templates-loader?modules=es6" },
   ...
]
hurano commented 6 years ago

I tired but it didn't work correctly.

I am getting some error. App.js:6 Uncaught TypeError: (0 , _App2.default) is not a function

The source is here. https://github.com/hurano/react-sass-template/tree/template

nippur72 commented 6 years ago

I cloned the repo and tried to fix it, but I'm unable to locate the problem.

Apparently webpack is not resolving the line:

import App from './js/App';

but it's leaving it untouched, and thus App.js is not included in the bundle (and rt not being called).

Tip: you can debug which files are processed by the loaders by chaining echo-loader.