I have a project on react using redux. when I write in the file of my project import redux from 'redux'; This is imported from the ./node_modules/redux/lib/index.js directory because the main file itself is defined in the configurations (package.json) redux itself: "lib / index.js". those. imported READY compiled redux.

what I want? I want to take redux sources, i.e. import not from lib / index.js, but from src / index.js. I change the main property in package.json

If you now look at my webpack.config.js config, then it looks like this:

... loaders: [{ test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel', query: { plugins: ['transform-runtime'], presets: ['es2015', 'stage-0', 'react'] } } ... 

those. I explicitly state that you do not need to take files to compile from node_modules. The problem is that I do not know how to register an exception for my redux, so that it compiles. I tried to add the property below:

 include: /node_modules\/redux/, 

but so webpack swears. or just wanted to compile specifying (here is the old lib / index.js setting):

 include: __dirname + '/app', 

but I didn’t work with this team either. help with configuring config

    1 answer 1

    On a githaba they propose to do something like this:

     { test: /\.js$/, exclude: /node_modules\/(?!(redux)\/).*/, }, 
    • Yes it works. but there is one very important point! This feature does not work with the transform-runtime plugin. those. if you specify plugins: ['transform-runtime'] in loaders of the webpack, you will get an error with the error user2815962
    • @ user2815962, what's the error? - Duck Learns to Take Cover
    • compiles without errors, but if you try to open the assembled file, the Uncaught TypeError error is thrown: $ export is not a function - user2815962