Symlink Webpack Plugin
Webpack plugin for creating a symbolic link in any directory before compilation. This can be useful for code reuse without creating an npm package.
Installation
npm i -D @a.gusev/symlink-webpack-plugin
Usage
In your webpack config:
const SymlinkWebpackPlugin = require('@a.gusev/symlink-webpack-plugin');
module.exports = {
// ...etc
plugins: [
new SymlinkWebpackPlugin({
targetAbsolutePrefix: path.resolve(__dirname, "../common"), // default: output.path
pathAbsolutePrefix: __dirname, // default: output.path
paths: [
"src/css",
"src/js/styles",
"src/js/themes",
"src/js/utils",
".babelrc",
".browserslistrc",
".eslintrc.json"
]
})
]
};
This setting makes symbolic link <pathAbsolutePrefix>/src/css
to <targetAbsolutePrefix>/src/css
and etc.