webpack-contrib / imports-loader

Imports Loader
MIT License
520 stars 63 forks source link

README: add Inline `additionalCode` example #81

Closed wheeler closed 4 years ago

wheeler commented 4 years ago

Documentation Is:

Please Explain in Detail...

I did some experimenting and it looks like you can specify additionalCode inline. Currently the examples are only of type= and imports=.

Your Proposal for Changes

Add an example like:

import myLib from 'imports-loader?additionalCode=var%20require%20=%20false;!./example.js';
// Adds the following code to the beginning of example.js:
// var require = false;
alexander-akait commented 4 years ago

additionalCode is not good value for inline syntax, because you need escape spaces, in this case my recommendation is using webpack.config.js

alexander-akait commented 4 years ago

Done, for the simple case