Skip to content

Commit 034ec6a

Browse files
committed
ref: #187 update 09, 11 webpack
1 parent 121ac7c commit 034ec6a

4 files changed

Lines changed: 53 additions & 55 deletions

File tree

hooks/09_Sidebar/webpack.config.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ module.exports = {
3434
babelCore: "@babel/core", // needed for Babel v7
3535
},
3636
},
37-
{
38-
test: /\.css$/,
39-
include: /node_modules/,
40-
use: [MiniCssExtractPlugin.loader, "css-loader"]
41-
},
4237
{
4338
test: /\.css$/,
4439
exclude: /node_modules/,

hooks/11_TableAxios/.babelrc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
{
66
"useBuiltIns": "entry"
77
}
8-
]
9-
]
8+
],
9+
"@babel/preset-typescript",
10+
"@babel/preset-react"
11+
],
12+
"plugins": ["@babel/plugin-transform-runtime"]
1013
}

hooks/11_TableAxios/package.json

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,33 @@
1515
"author": "Braulio Diez Botella",
1616
"license": "MIT",
1717
"devDependencies": {
18-
"@babel/cli": "^7.2.3",
19-
"@babel/core": "^7.2.2",
20-
"@babel/polyfill": "^7.2.5",
21-
"@babel/preset-env": "^7.3.1",
22-
"@types/node": "^11.9.4",
23-
"@types/react": "^16.8.3",
24-
"@types/react-dom": "^16.8.1",
18+
"@babel/cli": "^7.10.5",
19+
"@babel/core": "^7.10.5",
20+
"@babel/plugin-transform-runtime": "^7.10.5",
21+
"@babel/polyfill": "^7.10.4",
22+
"@babel/preset-env": "^7.10.4",
23+
"@babel/preset-react": "^7.10.4",
24+
"@babel/preset-typescript": "^7.10.4",
25+
"@types/node": "^14.0.24",
26+
"@types/react": "^16.9.43",
27+
"@types/react-dom": "^16.9.8",
2528
"awesome-typescript-loader": "^5.2.1",
26-
"babel-loader": "^8.0.5",
27-
"css-loader": "^2.1.0",
28-
"file-loader": "^3.0.1",
29-
"html-webpack-plugin": "^3.2.0",
30-
"mini-css-extract-plugin": "^0.5.0",
31-
"style-loader": "^0.23.1",
32-
"typescript": "^3.3.3",
33-
"url-loader": "^1.1.2",
34-
"webpack": "^4.29.3",
35-
"webpack-cli": "^3.2.3",
36-
"webpack-dev-server": "^3.1.14"
29+
"babel-loader": "^8.1.0",
30+
"css-loader": "^3.6.0",
31+
"file-loader": "^6.0.0",
32+
"html-webpack-plugin": "^4.3.0",
33+
"mini-css-extract-plugin": "^0.9.0",
34+
"style-loader": "^1.2.1",
35+
"typescript": "^3.9.7",
36+
"url-loader": "^4.1.0",
37+
"webpack": "^4.43.0",
38+
"webpack-cli": "^3.3.12",
39+
"webpack-dev-server": "^3.11.0"
3740
},
3841
"dependencies": {
39-
"axios": "^0.18.0",
40-
"react": "^16.8.2",
41-
"react-dom": "^16.8.2"
42+
"@babel/runtime": "^7.10.5",
43+
"axios": "^0.19.2",
44+
"react": "^16.13.1",
45+
"react-dom": "^16.13.1"
4246
}
4347
}
Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
var HtmlWebpackPlugin = require("html-webpack-plugin");
2-
var MiniCssExtractPlugin = require("mini-css-extract-plugin");
3-
var webpack = require("webpack");
4-
var path = require("path");
1+
const HtmlWebpackPlugin = require("html-webpack-plugin");
2+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
3+
const webpack = require("webpack");
4+
const path = require("path");
55

6-
var basePath = __dirname;
6+
const basePath = __dirname;
77

88
module.exports = {
99
context: path.join(basePath, "src"),
1010
resolve: {
11-
extensions: [".js", ".ts", ".tsx", ".css"]
11+
extensions: [".js", ".ts", ".tsx", ".css"],
1212
},
1313
entry: ["@babel/polyfill", "./index.tsx"],
1414
output: {
1515
path: path.join(basePath, "dist"),
16-
filename: "bundle.js"
16+
filename: "bundle.js",
1717
},
1818
devtool: "source-map",
1919
devServer: {
2020
contentBase: "./dist", // Content base
2121
inline: true, // Enable watch and live reload
2222
host: "localhost",
2323
port: 8080,
24-
stats: "errors-only"
24+
stats: "errors-only",
2525
},
2626
module: {
2727
rules: [
@@ -31,13 +31,8 @@ module.exports = {
3131
loader: "awesome-typescript-loader",
3232
options: {
3333
useBabel: true,
34-
babelCore: "@babel/core" // needed for Babel v7
35-
}
36-
},
37-
{
38-
test: /\.css$/,
39-
include: /node_modules/,
40-
use: [MiniCssExtractPlugin.loader, "css-loader"]
34+
babelCore: "@babel/core", // needed for Babel v7
35+
},
4136
},
4237
{
4338
test: /\.css$/,
@@ -49,30 +44,31 @@ module.exports = {
4944
options: {
5045
modules: true,
5146
localIdentName: "[name]__[local]___[hash:base64:5]",
52-
camelCase: true
53-
}
54-
}
55-
]
47+
camelCase: true,
48+
},
49+
},
50+
],
5651
},
5752
{
5853
test: /\.(png|jpg|gif|svg)$/,
5954
loader: "file-loader",
6055
options: {
61-
name: "assets/img/[name].[ext]?[hash]"
62-
}
63-
}
64-
]
56+
name: "assets/img/[name].[ext]?[hash]",
57+
esModule: false,
58+
},
59+
},
60+
],
6561
},
6662
plugins: [
6763
//Generate index.html in /dist => https://github.com/ampedandwired/html-webpack-plugin
6864
new HtmlWebpackPlugin({
6965
filename: "index.html", //Name of file in ./dist/
7066
template: "index.html", //Name of template in ./src
71-
hash: true
67+
hash: true,
7268
}),
7369
new MiniCssExtractPlugin({
7470
filename: "[name].css",
75-
chunkFilename: "[id].css"
76-
})
77-
]
71+
chunkFilename: "[id].css",
72+
}),
73+
],
7874
};

0 commit comments

Comments
 (0)