A webpack plugin designed to support iLib configuration and asset copying.
This plugin is required for Webpack-based usage of @enact/i18n
.
npm install --save-dev @enact/dev-utils
In your webpack.config.js
:
const {ILibPlugin} = require('@enact/dev-utils');
// ...
plugins: [
new ILibPlugin();
],
You can pass optional configuration settings to ILibPlugin
.
Allowed values are as follows:
ilib
: Custom path to the iLib codebase. Alternatively, aILIB_BASE_PATH
environment variable can be set to specify a path. When passed an absoute path, theemit
option will be set tofalse
. Defaults tonode_modules/@enact/i18n/ilib
.resources
: Custom path to the app-level resource bundle. Defaults toresources
. Can be set tofalse
to disable detection/handling of app-level resources.bundles
: Any additional resource bundles to copy to the output directory. Defaults to[]
. Will automatically add the@enact/sandstone
ResBundle if detected.create
: Whether or not to dynamically generate anyilibmanifest.json
files, if a bundle is missing it. Defaults totrue
.emit
: Whether or not to emit the stock iLib locale assets to the output directory. Defaults totrue
.cache
: Whether or not to cache locale/resource assets and copy emit them if they're newer/changed from source files. Defaults totrue
.context
: Context directory for the app source. Determined automatically via webpack's context, however can be overriden with this property.relativeResources
: Whether or not the app-level resources should be resolved relative to the HTML, rather than the public path.symlinks
: Whether or not to resolve symlinks' real paths when handling bundles. Similar to webpack'sresolve.symlinks
option. Defaults totrue
.
Here's an example webpack config illustrating how to use these options:
{
entry: 'index.js',
output: {
path: 'dist',
filename: 'bundle.js'
},
plugins: [
new ILibPlugin({
ilib: '/usr/share/javascript/ilib',
cache: false
})
]
}