dll-factory
v0.0.3
Published
Wrapper over DllReferencePlugin which make possible bundling vendor packages
Downloads
4
Readme
dll-factory
Webpack DllPlugin manifest file keeps files list (exactly files, not dirs) resolved using .main
(and other similar) properties of package.json
of bundled packages. You can't import directory from dll, it must be a file:
// Import from dll without dll-factory
// react.js is the value taken from "main" proprety of react/package.json
import React from 'react/react.js';
// Import from dll with dll-factory applied
// "main" property of react/package.json is resolved
import React from 'react';
Wrapper over DllReferencePlugin which make possible import of bundled vendor packages. It takes manifest file content and changes it so that it then maps ./<module name>
which is used in app imports into manifesto entry. Originally manifest file contains exact files, which is not suitable for importing packages from bundle.
Originally created manifest:
{
"name": "vendor_fb20ea5237d914031248",
"content": {
"./react/react.js": {
"id": 0,
"meta": {}
}
}
}
will be translated into:
{
"name": "vendor_fb20ea5237d914031248",
"content": {
"./react": {
"id": 0,
"meta": {}
}
}
}
Usage example
Put this code into .plugins
section of webpack config file:
require('dll-factory').dllFactory({
// Parsed JSON for app's package.json
appPackage: require('package.json'),
// relative path to dir with dll. Default is ./dll
dllPath: './path-to-dll-dir',
// In case your app imports files from packages not from package.json:main entry point
// list these files in .extraImports.
// Optional param.
extraImports: [
'./react-redux-form/lib/utils/update-field'
],
// Scope to append import. Example below will lead to "import react from 'dll/react';"
scope: 'dll',
}),