bugfix for manifest path, extend to merge plugins

main v0.6.0
HerrHase 1 week ago
parent 0e3461afa1
commit c0fa667d94

@ -16,7 +16,8 @@ const glob = require('glob')
* @link https://git.node001.net/tiny-components/webpack.git
*
*/
module.exports = function tinyComponentsWebpack(files, options = {}) {
module.exports = function tinyComponentsWebpack(files, options = {}) {
// merge options with defaults
const defaults = Object.assign({
@ -24,9 +25,9 @@ module.exports = function tinyComponentsWebpack(files, options = {}) {
destination: path.resolve(process.cwd(), 'public'),
publicPath: '/',
purge: {
src: path.join(__dirname, 'js'),
safelist: []
}
src: path.join(__dirname, 'js')
},
plugins: []
}, options)
const config = {
@ -75,9 +76,10 @@ module.exports = function tinyComponentsWebpack(files, options = {}) {
filename: "fonts/[name].[ext]",
}
}]
},
}
}
plugins: [
config.plugins = defaults.plugins.concat([
new RemoveEmptyScriptsPlugin(),
new MiniCssExtractPlugin({
filename: 'css/[name].css',
@ -88,10 +90,9 @@ module.exports = function tinyComponentsWebpack(files, options = {}) {
}),
new ManifestPlugin({
filename: 'assets-manifest.json',
context: defaults.context
context: defaults.destination
})
],
}
])
// if rules exists add
if (defaults.rules) {
@ -101,7 +102,7 @@ module.exports = function tinyComponentsWebpack(files, options = {}) {
}
// adding svg src
if (defaults.svg && defaults.svg.src) {
if (defaults.svg.src) {
config.plugins.push(new SvgSpritemapPlugin(defaults.svg.src, {
output: {
filename: 'symbol-defs.svg',

@ -1,6 +1,6 @@
{
"name": "@tiny-components/webpack",
"version": "0.5.2",
"version": "0.6.0",
"description": "Webpack Wrapper",
"repository": {
"type": "git",

Loading…
Cancel
Save