New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

rename-output-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rename-output-webpack-plugin

Webpack plugin to rename outfile files / chunks generated by Webpack.

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
42
-43.24%
Maintainers
1
Weekly downloads
 
Created
Source

Rename Output Webpack Plugin

Webpack plugin to custom rename each outfile files / chunks generated during build.

npm GitHub issues GitHub license

Installation | Usage | License

Installation

npm install rename-output-webpack-plugin --save-dev

Usage

// webpack.config.js

const renameOutputPlugin = require('rename-output-webpack-plugin');

module.exports = {
    entry: {
        'core': './src/core.js',
        'app': './src/index.js',
        'jquery': ['jquery'],
        'angular-suite': ['angular', 'angular-ui-bootstrap', 'angular-ui-router'],
    },
    output: {
        'filename': '[name]-[id].js',
        'path': path.resolve(__dirname, 'dist')
    },
    plugins: [
        new renameOutputPlugin({
            'core': 'framework-[hash].js',
            'jquery': '[name]-[version].min.js',
            'angular-suite': '[name]-[version@angular].min.js'
        })
    ]
};

This configuration will generate following files:

Hash: 7aa4bcb22d7fa4791dd8
Version: webpack 3.8.1
Time: 1812ms
                            Asset     Size  Chunks                    Chunk Names
                         app-0.js  2.08 MB       0  [emitted]  [big]  app
       angular-suite-1.6.6.min.js  1.73 MB       1  [emitted]  [big]  angular-suite
              jquery-3.2.1.min.js   271 kB       2  [emitted]  [big]  jquery
framework-7aa4bcb22d7fa4791dd8.js   271 kB       3  [emitted]  [big]  core

Using [version]

In Webpack configuration (webpack.config.js), output.filename supports following substitutions:

  • [hash]
  • [chunkhash]
  • [name]
  • [id]
  • [query]

This plugin adds one more substitution [version]. [version] allow you to use version of dependency within your output bundle filename. For e.g. If you are using jquery and chunking it separately, you can add [version] to ensure right version (from jquery module package.json) is added within output filename.

module.exports = {
    entry: {
        'jquery': ['jquery']
    },
...
    plugins: [
        new renameOutputPlugin({
            'jquery': '[name]-[version].min.js'
        })
    ]
};
              Asset     Size  Chunks                    Chunk Names
jquery-3.2.1.min.js   271 kB       2  [emitted]  [big]  jquery

License

This project is licensed under the MIT License - see the LICENSE file for details

Keywords

webpack

FAQs

Package last updated on 15 Nov 2017

Did you know?

Socket

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