webpack-entry-wrapper
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

webpack-entry-wrapper

CircleCI

Wrap entry points with any code

Description

This plugin is useful when you need to wrap entry point with custom code, which should be executed before original entry point. Plugin provides path to an original entry point so you need to import it manually in your wrapper.

E.g. you need to set public path in runtime but don't want to have this logic in entry point.

Install

npm i -D webpack-entry-wrapper

Usage

const WebpackEntryWrapper = require('webpack-entry-wrapper');

module.exports = {
  entry: './main',
  plugins: [
    new WebpackEntryWrapper({
      include: /main.js/,
      template: 'data/template.js'
    })
  ]
}

template example

const entry = require('${entry}');

console.log(entry);

Options

Name Type Default Description
include {RegExp} null included entries, By default plugin applies to all entry points
template (required) string undefined Path to a wrapper template

Template variables

Variable Description
entry relative path to entry point

Readme

Keywords

none

Package Sidebar

Install

npm i webpack-entry-wrapper

Weekly Downloads

45

Version

1.0.1

License

MIT

Unpacked Size

15.8 kB

Total Files

12

Last publish

Collaborators

  • olly12mm