Skip to content

Commit 81d57f6

Browse files
committed
Update:
Webpack Storybook eslint node-sass -> sass
1 parent cd55db2 commit 81d57f6

File tree

6 files changed

+55
-49
lines changed

6 files changed

+55
-49
lines changed

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14

.storybook/addons.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

.storybook/config.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

.storybook/main.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const baseStorybookConfig = {
2+
core: {
3+
builder: 'webpack5'
4+
},
5+
stories: [
6+
`${process.cwd()}/stories/**/*.stories.@(js|tsx)`
7+
],
8+
reactOptions: {
9+
fastRefresh: true
10+
},
11+
addons: [
12+
'@storybook/addon-essentials',
13+
'@storybook/addon-links'
14+
]
15+
};
16+
17+
module.exports = baseStorybookConfig;

package.json

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-linear-gradient-picker",
3-
"version": "2.0.3",
3+
"version": "2.0.4-beta.1",
44
"description": "React linear gradient picker",
55
"main": "dist/index.js",
66
"scripts": {
@@ -26,25 +26,25 @@
2626
},
2727
"homepage": "https://github.com/odedglas/react-linear-gradient-picker#readme",
2828
"devDependencies": {
29-
"@babel/core": "^7.6.0",
30-
"@babel/plugin-transform-runtime": "^7.6.0",
31-
"@babel/preset-env": "^7.6.0",
32-
"@babel/preset-react": "^7.0.0",
33-
"@storybook/addon-actions": "^5.2.1",
34-
"@storybook/addon-links": "^5.2.1",
35-
"@storybook/addons": "^5.2.1",
36-
"@storybook/react": "^5.2.1",
29+
"@babel/core": "^7.18.0",
30+
"@babel/plugin-transform-runtime": "^7.18.0",
31+
"@babel/preset-env": "^7.18.0",
32+
"@babel/preset-react": "^7.17.0",
33+
"@storybook/addon-essentials": "^6.4.0",
34+
"@storybook/addon-links": "^6.4.0",
35+
"@storybook/manager-webpack5": "^6.4.0",
36+
"@storybook/cli": "^6.4.0",
37+
"@storybook/react": "^6.4.0",
3738
"@storybook/storybook-deployer": "^2.8.1",
38-
"babel-loader": "^8.0.6",
39-
"classnames": "^2.2.6",
40-
"css-loader": "^3.2.0",
41-
"eslint": "^6.4.0",
42-
"eslint-plugin-import": "^2.18.2",
43-
"eslint-plugin-react": "^7.14.3",
44-
"eslint-plugin-react-hooks": "^2.0.1",
45-
"lodash": "^4.17.15",
46-
"mini-css-extract-plugin": "^0.8.0",
47-
"node-sass": "^4.13.0",
39+
"babel-loader": "^8.2.5",
40+
"classnames": "^2.3.1",
41+
"css-loader": "^6.7.1",
42+
"eslint": "^8.16.0",
43+
"eslint-plugin-import": "^2.26.0",
44+
"eslint-plugin-react": "^7.30.0",
45+
"eslint-plugin-react-hooks": "^4.5.0",
46+
"mini-css-extract-plugin": "^2.6.0",
47+
"sass": "^1.52.1",
4848
"prop-types": "^15.7.2",
4949
"rc-color-picker": "^1.1.5",
5050
"react": "^16.9.0",
@@ -53,11 +53,12 @@
5353
"sass-loader": "^8.0.0",
5454
"style-loader": "^1.0.0",
5555
"svg-url-loader": "^3.0.2",
56-
"terser-webpack-plugin": "^2.1.0",
57-
"webpack": "^4.40.2",
58-
"webpack-cli": "^3.3.9"
56+
"terser-webpack-plugin": "^5.3.1",
57+
"webpack": "^5.72.1",
58+
"webpack-cli": "^4.9.2"
5959
},
6060
"dependencies": {
61+
"@storybook/builder-webpack5": "^6.4.0",
6162
"linear-gradient-parser": "^1.1.8"
6263
}
6364
}

webpack.config.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,23 @@ module.exports = {
99
externals: {
1010
'react': 'react',
1111
},
12-
target: 'node',
12+
target: 'web',
1313
output: {
1414
path: path.join(__dirname, 'dist'),
1515
filename: 'index.js',
16-
library: 'linearGradientPicker',
17-
libraryTarget: 'commonjs2'
16+
library: {
17+
type: 'commonjs2'
18+
}
1819
},
1920
module: {
2021
rules: [
21-
{
22-
test: /\.svg/,
23-
loaders: [ 'svg-url-loader' ]
24-
},
2522
{
2623
test: /\.css$/,
27-
use: [MiniCssExtractPlugin.loader, "css-loader"],
24+
use: [MiniCssExtractPlugin.loader, 'css-loader'],
2825
},
2926
{
3027
test: /\.(png|jp(e*)g)$/,
31-
use: [{
32-
loader: 'url-loader',
33-
options: {
34-
limit: 8000, // Convert images < 8kb to base64 strings
35-
name: 'images/[hash]-[name].[ext]'
36-
}
37-
}]
28+
type: 'asset/inline'
3829
},
3930
{
4031
test: /\.(js|jsx)$/,
@@ -50,6 +41,13 @@ module.exports = {
5041
],
5142
optimization: {
5243
minimize: true,
53-
minimizer: [ new TerserPlugin() ],
44+
minimizer: [ new TerserPlugin({
45+
terserOptions: {
46+
output: {
47+
comments: false
48+
}
49+
},
50+
extractComments: false
51+
}) ],
5452
}
5553
};

0 commit comments

Comments
 (0)