2.0.0 • Published 3 years ago

webpack-async-define v2.0.0

Weekly downloads
11
License
MIT
Repository
github
Last release
3 years ago

webpack-async-define

This simple plugin can be used to wrap a webpack bundle in async-define.

How to use it

Step 1: Set the name of your bundle (optional):

output: {
  ...
  library: 'Foo',
  libraryTarget: 'amd' // this is forced automatically by the plugin
},

Step 2: Set the external devDependencies (optional)

externals: {
  react: 'react-15.3',
  'react-dom': 'reactdom-15.3',
  nameOfTheLib: label,
},

Step 3: Use the plugin

var WPAsyncDefine = require('webpack-async-define');
...
plugins: [
  ...
  new WPAsyncDefine(),
],

You can now use this library with async-define (https://github.com/tes/async-define).

Note: This procedure does not allow to create a bundle that satisfies MULTIPLE dependencies. You can do it manually building something like this:

var asyncDefine = require('async-define');
var react = require('react');
var reactDom = require('react-dom');

asyncDefine('react-15.3', function () {
  return react;
});

asyncDefine('reactdom-15.3', function () {
  return reactDom;
});
2.0.0

3 years ago

1.1.7

4 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

6 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago