1.0.4 • Published 6 years ago

@friends-of-js/include-import-loader v1.0.4

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

@friends-of-js/include-import-loader

Build Status Test Coverage Maintainability license

Webpack loader for including files in your bundles, that can be usefull in testing

Install

npm install --save-dev @friends-of-js/include-import-loader

Usage

webpack.config.js

const path = require('path')

module.exports = {
  module: {
    rules: [
      {
        enforce: 'pre',
        test: /\.spec\.js$/,
        use: [
          {
            loader: '@friends-of-js/include-import-loader',
            options: {
              type: 'import',
              files: [
                path.resolve(__dirname, 'prepare/test-environment.js')
              ]
            }
          }
        ]
      }
    ]
  }
}

Generated code

This loader would add at top of your spec bundles this code:

import 'absolute_path/prepare/test-environment.js'
// your code

If your set type to 'require', it would produce this code:

require('absolute_path/prepare/test-environment.js')
// your code

Options

NameTypeDefaultDescription
type{String}require'import' or 'require'
files{String[]}undefinedSpecify array of files to include in your code. Should be an absolute path. If you specify files property - file property would be ignored
file{String}undefinedSpecify file to include in your code. Should be an absolute path.

License

@friends-of-js/include-import-loader © Dmitriy Romanov, released under the MIT License. Authored and maintained with help from contributors (list).

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago