create-symlink-webpack-plugin

webpack 4 plugin to generate symlinks

Usage no npm install needed!

<script type="module">
  import createSymlinkWebpackPlugin from 'https://cdn.skypack.dev/create-symlink-webpack-plugin';
</script>

README

How it works

webpack 4 plugin to generate symlinks

Usage

const CreateSymlinkPlugin = require('create-symlink-webpack-plugin');
module.exports = {
    plugins: [
        new CreateSymlinkPlugin([
            {
                origin: 'index-[hash].html',
                symlink: '200.html',
            },
        ])
    ]
}

All paths are relative to your webpack output.path

You can pass in either an object, or an array of objects. there is also an optional force parameter, that will caused it to create the symlink even if the destination file doesn't exist:

const CreateSymlinkPlugin = require('create-symlink-webpack-plugin');
module.exports = {
    plugins: [
        new CreateSymlinkPlugin([
            {
                origin: 'index-[hash].html',
                symlink: '200.html',
            },
            true
        ])
    ]
}

Options

  • origin path to the original file or directory
  • symlink path for the symlink

These are both relative to your webpack output.path