javascript - Webpack loader order misbehaved -


i have used webpack ^2.2.1. have added loaders in webpack.config.js file.

but loader have not call in order.

i used babel-loader transform react-es6 codes react-es5 codes. custom-loader need react-es6 code. put loader first. have print source content in each loaders. every time first printing babel-loader info. after printing info.

is loader order correct?

help me! in advance!

   // webpack.config.js      module.exports = {       entry: './src/index.js',       output: {          filename: 'bundle.js',          path: path.resolve(__dirname, './build')       }       module: {          loaders: [             {                 test: /\.js$/,                 use: 'my-custom-loader'             },             {                 test: /\.js$/,                 use: [                    {                       loader: 'babel-loader',                       options: {                          presets: ['babel-preset-es2015', 'babel-preset-react']                       }                    }                 ]             }          ]       }     } 

loaders in webpack used in order "right left" last loader in array used first. therefore babel translating , loader second in line.

see: what loader order webpack?

try switching order of loaders (and of course use module.rules instead of module.loaders, using new pattern in webpack 2)


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -