From af4d75ef35400e750de4d4f207b6507606872dd7 Mon Sep 17 00:00:00 2001 From: romainberger Date: Tue, 26 Apr 2016 16:39:08 +0200 Subject: [PATCH] Documentation and remove unused imported stuff --- README.md | 14 +++++--------- src/plugin.js | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e73a1ab..dc9dc57 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,11 @@ This will produce a `bundle.js` and a bundle for each value given to the plugin var translations = require(`./i18n/en.i18n`) ``` -With the configuration above, this will produce three bundles: `bundle-en.js` with `translations` being the content of `./i18n/en.i18n`, `bundle-fr.js` with the content of `./i18n/fr.i18n` and `bundle-es.js` with the content of `./i18n/es.i18n`. +With the configuration above, this will produce three bundles: `en.bundle.js` with `translations` being the content of `./i18n/en.i18n`, `fr.bundle.js` with the content of `./i18n/fr.i18n` and `es.bundle.js` with the content of `./i18n/es.i18n`. + +### Code splitting + +Using `require.ensure()`? No problem. If the module you require needs also require some `.i18n` files (following the example above), the plugin will also create multiple versions for all given values. And all bundles will load the appropriate chunks: for example, the bundle `fr.bundle.js` will load the chunk `fr.1.bundle.js`. ## Options @@ -139,11 +143,3 @@ plugins: [ * `OccurenceOrderPlugin` * `UglifyJsPlugin` * `extract-text-webpack-plugin` - -## Todo - -* make it work with multiple entries / code splitting - -Bonus: - -* make it work with sourcemap diff --git a/src/plugin.js b/src/plugin.js index 5f49911..312f25e 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -7,7 +7,7 @@ import mkdirp from 'mkdirp' import clone from 'lodash.clone' import merge from 'lodash.merge' import {ConcatSource} from 'webpack-sources' -import {forEachOfLimit, mapLimit, setImmediate as asyncSetImmediate} from 'async' +import {forEachOfLimit, setImmediate as asyncSetImmediate} from 'async' const baseAssets = { filename: 'assets.json',