code-inject-loader

0.0.1 • Public • Published

code-inject-loader

Inject code to certain files

How to use

Add as a loader rule to configure which files the loader should inject code into.

webpack.config.js

moule.exports = {
    ...,

    module: {
        rules: [
            {
                test: /src/,
                loader: 'code-inject-loader',
                options: {
                    prepend: `console.log('Hello Im in every file');`
                },
            },
            ...
        ]
    },

    ...
}

Options

  • prepend Add code to the beginning of the file
  • append Add code to the bottom of the file
  • transform(source) Function to make changes to the source code of the file

Readme

Keywords

none

Package Sidebar

Install

npm i code-inject-loader

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

2.58 kB

Total Files

4

Last publish

Collaborators

  • hirokiosame