gaearon / react-hot-loader

Tweak React components in real time. (Deprecated: use Fast Refresh instead.)
http://gaearon.github.io/react-hot-loader/
MIT License
12.26k stars 801 forks source link

Feature: allow webpack 4 type javascript/esm #875

Open hlehmann opened 6 years ago

hlehmann commented 6 years ago

In webpack 4 we can set file types such as "javascript/esm" which have more restriction.

With type "javascript/esm" we can't use require, exports and module anymore. But there is still import, export and __webpack_module__

Could it be possible to add a esm param to the babel plugin to be able to only use esm import/export

// .babelrc
{
  "plugins": [["react-hot-loader/babel",{esm:true}]]
}
theKashey commented 6 years ago

There is no need for a special flag, but few things had to be rethinked.