Socket
Socket
Sign inDemoInstall

dll-factory

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dll-factory

Wrapper over DllReferencePlugin which make possible bundling vendor packages


Version published
Maintainers
1
Created

Readme

Source

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',
}),

FAQs

Last updated on 27 Sep 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc