2.0.0 • Published 6 years ago

@hscmap/assets-installer-plugin v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

Assets Installer Plugin

Introduction

We can use webpack's library mode for creating a commonjs package. Let's assume that we created a package named 'myPackage'. To use this package from consumer side, simply do "require('myPackage')".

However, if the package requires files other than main entry point, that are emitted by loaders such as file-loader and worker-loader, it is necessary to make those files in "dist" directory in the consumer side.

This webpack plugin copies the files that was emitted by file-loader, worker-loader, etc. to "dist" directory of the consumer side.

Example

const AssetsInstallerPlugin = require('@hscmap/assets-installer-plugin')

module.exports = {
    ...,
    plugins: [
        new AssetsInstallerPlugin({
            files: [
                ['@hscmap/stellar-globe', '{*.json,*.worker.js}']
            ]
        })
    ]
}

Reference

Options

  • files: [string, string][]
    • specifies files to copy
    • 1st item of each entry stands for name of the module   2nd item of each entry stands for patterns of files to copy (default: '{.json,*.worker.js}')
  • always: boolean (default: false)
    • if true, copy files on every compilation
    • if no, copy files once upon starting webpack
2.0.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago