From 0da9f89c7ad470ffa18b2460e83fdfd49c8f15f2 Mon Sep 17 00:00:00 2001 From: HerrHase Date: Wed, 20 Mar 2024 10:01:25 +0100 Subject: [PATCH] bugfix for directory and resolve path, url for assets is to false --- index.js | 19 ++++++++++++++++--- package.json | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index f61b28f..bcfa31e 100644 --- a/index.js +++ b/index.js @@ -11,7 +11,7 @@ module.exports = function tinyComponentsWebpack(files, options = {}) { // merge options with defaults const defaults = Object.assign({ - destination: path.resolve(__dirname, 'public'), + destination: path.resolve(process.cwd(), 'public'), purge: { src: path.join(__dirname, 'js') } @@ -24,6 +24,10 @@ module.exports = function tinyComponentsWebpack(files, options = {}) { filename: 'js/[name].js', }, + resolve: { + modules: ['node_modules'], + }, + optimization: { removeEmptyChunks: true, minimize: true, @@ -41,12 +45,21 @@ module.exports = function tinyComponentsWebpack(files, options = {}) { module: { rules: [{ - test: /\.scss$/, + test: /\.(css|scss)$/, use: [ MiniCssExtractPlugin.loader, - 'css-loader', + { + loader: 'css-loader', + options: { url: false } + }, 'sass-loader' ] + },{ + test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/, + type: 'asset/resource', + generator: { + filename: "fonts/[name].[ext]", + } }] }, diff --git a/package.json b/package.json index bc647cb..381e122 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tiny-components/webpack", - "version": "0.2.0", + "version": "0.3.0", "description": "Webpack Wrapper", "repository": { "type": "git",