0.0.1 • Published 4 years ago

code-inject-loader v0.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

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