Skip to content

Commit

Permalink
fixed bugs + loaders => use. v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
goldingdamien committed Jun 15, 2022
1 parent 18523ca commit c7a40b9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
36 changes: 24 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
// Keep dependencies to a minimum. Add dependencies if required for the functions you use.
const path = require('path')

/**
* Support the latest stable webpack version by default.
* Add support for older versions and conversions via "Helpers".
*/

function webpack() {
return require('webpack')
}
Expand Down Expand Up @@ -48,9 +53,8 @@ const Rules = {
htmlString: () => {
return {
test: /\.html$/,
loaders: [
'raw-loader'
]
// loaders: ['raw-loader']
use: ['raw-loader']
}
},
/**
Expand All @@ -60,7 +64,7 @@ const Rules = {
cssString: () => {
return {
test: /\.css$/,
loaders: [
use: [ // loaders: [
'to-string-loader',
'css-loader'
]
Expand All @@ -70,19 +74,26 @@ const Rules = {
* https://github.com/webpack-contrib/file-loader
*/
image: () => {
const options = {
name: '[name].[ext]',
outputPath: 'components/assets/images/'
// the images will be emited to dist/.../components/assets/images/ folder
}
return {
test: /\.(jpe?g|png|gif|svg)$/i,
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'components/assets/images/'
// the images will be emited to dist/.../components/assets/images/ folder
}
// loader: 'file-loader',
// options
use: [
{
loader: 'file-loader',
options
}
]
}
},
common: () => {
return [
Rules.json(),
// Rules.json(),
Rules.htmlString(),
Rules.cssString(),
Rules.image(),
Expand Down Expand Up @@ -210,7 +221,8 @@ class WebpackRecipes {
return {
test: /\.(js)$/,
exclude: /node_modules/,
loader: 'babel-loader'
// loader: 'babel-loader'
use: 'babel-loader'
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@theopenweb/webpack-helpers",
"version": "1.3.0",
"version": "1.4.0",
"description": "Collection of webpack helpers for easily generating config.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit c7a40b9

Please sign in to comment.