move-copy-chunk-webpack-plugin
v1.0.0
Published
Webpack plugin which allows you to move, copy chunk from output directory to another location after emeting files
Downloads
123
Maintainers
Readme
npm i -D move-copy-chunk-webpack-plugin
webpack.config.js
const MoveCopyChunkPlugin = require('move-copy-chunk-webpack-plugin')
const config = {
...
plugins: [
new MoveCopyChunkPlugin([
{
actionType: 'copy',
pattern: 'myChunkA.*.js',
to: 'tmp.chunk.dir'
},
{
actionType: 'move',
pattern: 'myChunkB.*.js',
to: 'moved.chunk.dir'
}
])
]
}
Configuration
|Name|Type|Description|
|:--:|:--:|:---------:|
|actionType
|{String}
|The type of action that can be used move
or copy
|pattern
|{String\|RegEx}
|The chunk name to apply the action type, you can use RegEx to match chunk name minimatch options|
|to
|{String}
|The path to the destination folder.
|context
|{String}
|Path from where the to
should be resolved, by default compiler.options.context
actionType
webpack.config.js
[
new MoveCopyChunkPlugin([
{
actionType: 'copy',
pattern: 'myChunkA.*.js',
to: 'copied.chunk.dir'
},
{
actionType: 'move',
pattern: 'myChunkB.*.js',
to: 'moved.chunk.dir'
}
])
]
pattern
webpack.config.js
[
new MoveCopyChunkPlugin([
{
actionType: 'copy',
pattern: '*.css',
to: 'myTempDirectory'
},
{
actionType: 'move',
pattern: 'bundle.*.js',
to: '/myTempDirectory'
},
{
actionType: 'move',
pattern: '*chunks.*.js',
to: 'myChunksDir'
}
])
]
to
webpack.config.js
[
new MoveCopyChunkPlugin([
{
actionType: 'copy',
pattern: 'myChunkA.*.js',
to: 'myTempDirectory'
},
{
actionType: 'move',
pattern: 'myChunkB.*.js',
to: '/myTempDirectory'
}
])
]
context
[
new MoveCopyChunkPlugin([
{
actionType: 'copy',
pattern: 'myChunkA.*.js',
to: 'myTempDirectory',
context: 'chunks/'
},
{
actionType: 'move',
pattern: 'myChunkB.*.js',
to: './src/asyncChunk'
}
])
]
Optional options
|Name|Type|Description|
|:--:|:--:|:---------:|
|logInfo
|{Boolean}
|Enable or disable the log display for the moved
or copied
files (by default the value is true
)
logInfo
[
new MoveCopyChunkPlugin([
{
actionType: 'move',
pattern: 'myChunkB.*.js',
to: 'tmp/asyncChunk'
}],
{ logInfo: false }
)
]