loader order with `babel-loader`
See original GitHub issuethe order of this loader is always prior to babel-loader
loaders: ['react-hot', 'babel?preset[]=es2015,preset[]=react']
and babel-loader give an error complaining that import need to be at the top level which should be caused by the wrapper from react-hot
I fix it by putting babel to pre-loader.
Maybe react-hot just ignore the loader order? It will be appreciated if the start-up how-to page mention this.
Issue Analytics
- State:
- Created 8 years ago
- Comments:16 (4 by maintainers)
Top Results From Across the Web
babel-loader - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >Webpack loader order misbehaved - Stack Overflow
Loaders in Webpack are used in order "right to left" so the last loader in your array is used first. Therefore babel is...
Read more >How to Webpack 5 with Babel - Setup Tutorial
A step by step tutorial on how to integrate Babel into Webpack to access powerful JavaScript features (ES6, ES7, ES8, ES9) from the...
Read more >Options - Babel.js
Config Loading options. Loading configuration can get a little complex as environments can have several types of configuration files, and those configuration ...
Read more >Compiling TypeScript via webpack and babel-loader - 2ality
As a work-around, we can use babel-loader to compile TypeScript. This blog post explains how. ... The order of the presets seems to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @mdreizin
Still react-hot-loader + babel-loader + webpack 2 = 💔 ?
Have you found a solution or a workaround ?
Best regards
I had assumed the
2.0.0-alphareleases ofreact-hot-loaderwould have addressed any obvious webpack 2 issues, but I see the same error above'import' and 'export' may only appear at the top level, due to the"use strict"at the top of the hot file.Can there just be a
queryoption to disable the"use strict"or something? I can certainly look into a PR for this if you think this would be a good way of solving this @gaearon