Skip to content

Commit 5ae2cad

Browse files
authored
Update webpack (#39)
* Update webpack * feedback
1 parent dca0683 commit 5ae2cad

File tree

5 files changed

+4472
-6528
lines changed

5 files changed

+4472
-6528
lines changed

.babelrc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2-
"presets": ["env"],
3-
"plugins": ["transform-object-rest-spread", "transform-react-jsx"]
4-
}
2+
"presets": [
3+
"@babel/preset-env",
4+
"@babel/preset-react"
5+
]
6+
}

package.json

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
"main": "./dist/ReactNetflixPlayer.js",
66
"license": "MIT",
77
"scripts": {
8-
"start": "webpack-dev-server --config webpack.config.dev.js",
9-
"build": "webpack",
10-
"test": "echo \"Error: no test specified\" && exit 1"
8+
"serve": "webpack serve --mode development",
9+
"build": "webpack --mode production"
1110
},
1211
"repository": {
1312
"type": "git",
@@ -26,38 +25,30 @@
2625
},
2726
"author": "Lucas Junior Dias",
2827
"devDependencies": {
29-
"babel-cli": "^6.26.0",
30-
"babel-core": "^6.21.0",
31-
"babel-loader": "^7.1.4",
32-
"babel-plugin-transform-object-rest-spread": "^6.26.0",
33-
"babel-plugin-transform-react-jsx": "^6.24.1",
34-
"babel-preset-env": "^1.6.1",
35-
"babel-preset-react": "^6.16.0",
36-
"babel-preset-stage-0": "^6.24.1",
37-
"eslint": "^7.7.0",
38-
"eslint-config-airbnb": "^18.2.0",
39-
"eslint-config-prettier": "^6.11.0",
40-
"eslint-plugin-import": "^2.22.0",
41-
"eslint-plugin-jsx-a11y": "^6.3.1",
42-
"eslint-plugin-prettier": "^3.1.4",
43-
"eslint-plugin-react": "^7.20.6",
44-
"eslint-plugin-react-hooks": "^4.1.0",
45-
"extract-text-webpack-plugin": "^3.0.2",
46-
"prettier": "^2.0.5",
47-
"webpack": "^4.43.0",
48-
"webpack-cli": "^3.2.1",
49-
"webpack-dev-server": "^3.11.0"
50-
},
51-
"peerDependencies": {
52-
"react": "^16 || ^17",
53-
"react-dom": "^16 || ^17"
28+
"@babel/cli": "^7.18.6",
29+
"@babel/core": "^7.18.6",
30+
"@babel/preset-env": "^7.18.6",
31+
"@babel/preset-react": "^7.18.6",
32+
"babel-loader": "^8.2.3",
33+
"eslint": "^8.17.0",
34+
"eslint-config-airbnb": "^19.0.4",
35+
"eslint-config-prettier": "^8.5.0",
36+
"eslint-plugin-import": "^2.26.0",
37+
"eslint-plugin-jsx-a11y": "^6.6.0",
38+
"eslint-plugin-prettier": "^4.2.1",
39+
"eslint-plugin-react": "^7.30.1",
40+
"eslint-plugin-react-hooks": "^4.6.0",
41+
"prettier": "^2.5.1",
42+
"webpack": "^5.70.0",
43+
"webpack-cli": "^4.9.2",
44+
"webpack-dev-server": "^4.9.3"
5445
},
5546
"dependencies": {
56-
"i18next": "^19.7.0",
57-
"react-i18next": "^11.7.1",
58-
"react-icons": "^3.9.0",
59-
"styled-components": "^5.1.1",
60-
"react": "^17",
61-
"react-dom": "^17"
47+
"i18next": "^21.8.14",
48+
"react": "^18.2.0",
49+
"react-dom": "^18.2.0",
50+
"react-i18next": "^11.18.1",
51+
"react-icons": "^4.4.0",
52+
"styled-components": "^5.3.5"
6253
}
63-
}
54+
}

webpack.config.dev.js

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

webpack.config.js

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
11
// webpack.config.js
2-
const path = require('path');
2+
const path = require("path");
33

44
module.exports = {
5-
mode: 'production',
65
entry: './src/components/ReactNetflixPlayer/index.js',
7-
output: {
8-
path: path.resolve(__dirname, 'dist'),
9-
filename: 'ReactNetflixPlayer.js',
10-
libraryTarget: 'commonjs2',
11-
},
12-
module: {
13-
rules: [
14-
{
15-
test: /\.js$/,
16-
include: path.resolve(__dirname, 'src'),
17-
exclude: /node_modules/,
18-
use: {
19-
loader: 'babel-loader',
20-
options: {
21-
presets: ['env'],
22-
},
23-
},
24-
},
25-
],
26-
},
6+
output: {
7+
path: path.join(__dirname, "/dist"),
8+
filename: "ReactNetflixPlayer.js",
9+
},
10+
module: {
11+
rules: [
12+
{
13+
test: /\.(js|jsx)$/,
14+
loader: "babel-loader",
15+
exclude: /node_modules/,
16+
},
17+
{
18+
test: /\.css$/,
19+
use: ["style-loader", "css-loader"],
20+
},
21+
],
22+
},
2723
externals: {
2824
react: 'react',
2925
'react-dom': 'ReactDOM',
@@ -33,4 +29,4 @@ module.exports = {
3329
'react-icons/fa': 'react-icons/fa',
3430
'react-icons/fi': 'react-icons/fi',
3531
},
36-
};
32+
};

0 commit comments

Comments
 (0)