Skip to content

Commit d8e0e0f

Browse files
attempt at webpack config
1 parent 635cd95 commit d8e0e0f

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,17 @@
3737
]
3838
},
3939
"devDependencies": {
40+
"@teamsupercell/typings-for-css-modules-loader": "^2.1.1",
4041
"@testing-library/dom": "^7.2.1",
4142
"bootstrap": "^4.4.1",
43+
"clean-webpack-plugin": "^3.0.0",
44+
"html-webpack-plugin": "^4.2.0",
4245
"jquery": "1.9.1",
4346
"popper.js": "^1.16.0",
4447
"rambda": "^5.1.0",
4548
"react-bootstrap": "^1.0.0",
46-
"turbocommons-ts": "^3.1.0"
49+
"react-dev-utils": "^10.2.1",
50+
"turbocommons-ts": "^3.1.0",
51+
"webpack": "^4.42.1"
4752
}
4853
}

webpack.config.js

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
2+
const HtmlWebpackPlugin = require("html-webpack-plugin");
3+
//const InlineChunkHtmlPlugin =
4+
// require("react-dev-utils/InlineChunkHtmlPlugin");
5+
6+
module.exports = {
7+
entry: './src/index.tsx',
8+
plugins: [
9+
new CleanWebpackPlugin({
10+
cleanAfterEveryBuildPatterns: ['public/build']
11+
}),
12+
new HtmlWebpackPlugin({
13+
inject: true,
14+
template: 'public/index.html',
15+
}),
16+
// new InlineChunkHtmlPlugin(
17+
// HtmlWebpackPlugin,
18+
// // [/runtime/], {
19+
// // inlineChunks: ['manifest']
20+
// // }
21+
// )
22+
],
23+
output: {
24+
path: __dirname + '/public',
25+
filename: 'build/[name].[contenthash].js'
26+
},
27+
resolve: {
28+
extensions: ['.ts', '.tsx', '.js']
29+
},
30+
module: {
31+
rules: [
32+
{ test: /\.tsx?$/, exclude: /node_modules/, loader: 'ts-loader' },
33+
{ test: /\.css$/i,
34+
use: [
35+
"style-loader",
36+
"@teamsupercell/typings-for-css-modules-loader",
37+
{
38+
loader: "css-loader",
39+
options: { modules: true }
40+
}
41+
]
42+
}
43+
]
44+
}
45+
}
46+
47+
// noinspection JSUndefinedPropertyAssignment
48+
module.loaders = [
49+
{ test: /\.css$/,
50+
loader: 'typings-for-css-modules-loader?modules&namedExport&camelCase' },
51+
{ test: /\.scss$/, loader: 'typings-for-css-modules-loader?modules&sass' }
52+
]

0 commit comments

Comments
 (0)