1.0.4 • Published 6 years ago

webpack-resolve-path-rewrite-plugin v1.0.4

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

webpack-resolve-path-rewrite-plugin

A plugin for enhanced-resolve (Webpack v2) that replaces specified string inside the path.

Installation

npm install --save-dev webpack-resolve-path-rewrite-plugin

Usage

var path = require('path');
var PathRewrite = require('webpack-resolve-path-rewrite-plugin');

module.exports = {
  // ...
  resolve: {
    plugins: [
      new PathRewritePlugin({pathMap: {
        '/module/': '/../../CommonEngine/src/module/'
      }})
    ]
  },
  // ...
};

Example:

webpack.config.js

new PathRewritePlugin({pathMap: {
  '/module/': '/../../CommonEngine/src/module/'
}})

actions/sendForm.js

import 'src/module/index' // Changes to 'src/../../CommonEngine/src/module/index'

Why

Why rewrite paths?

When: 1. Multiple entrypoints require a common module inside their directory (i.e. submodule) 2. You want to use CommonsChunkPlugin

npm.io

Change log

1.0.1

Solved bugs.

1.0.0

Initial release.

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago