1.0.1 • Published 2 years ago

webpack-entry-wrapper v1.0.1

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

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

NameTypeDefaultDescription
include{RegExp}nullincluded entries, By default plugin applies to all entry points
template (required)stringundefinedPath to a wrapper template

Template variables

VariableDescription
entryrelative path to entry point
1.0.1

2 years ago

1.0.0

3 years ago

1.0.0-alpha.3

3 years ago

1.0.0-alpha.2

3 years ago

1.0.0-alpha.1

3 years ago

0.0.2

5 years ago

0.0.1

5 years ago