Skip to content

Commit c3251f2

Browse files
committed
refactor(web-ts-results): webpack config
1 parent 5542d46 commit c3251f2

File tree

5 files changed

+27
-49
lines changed

5 files changed

+27
-49
lines changed

webdriver-ts-results/package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webdriver-ts-results/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "webdriver-ts-results",
33
"version": "0.1.0",
44
"private": true,
5+
"type": "module",
56
"dependencies": {
67
"jstat": "^1.9.6",
78
"plotly.js-cartesian-dist": "2.18.2",
@@ -16,7 +17,7 @@
1617
"test": "react-scripts test",
1718
"eject": "react-scripts eject",
1819
"lint": "eslint './src/**/*.{ts,tsx}'",
19-
"build-prod": "rimraf --glob dist && cross-env NODE_ENV=\"production\" webpack --env prod -c webpack.config.js && rimraf --glob table.html && rimraf --glob \"BoxPlotTable*.js\" && cpx dist/table.html . && cpx \"dist/BoxPlotTable*.js\" . && cpx \"dist/plotly*.js\" ."
20+
"build-prod": "rimraf --glob dist && cross-env NODE_ENV=\"production\" webpack --env prod && rimraf --glob table.html && rimraf --glob \"BoxPlotTable*.js\" && cpx dist/table.html . && cpx \"dist/BoxPlotTable*.js\" . && cpx \"dist/plotly*.js\" ."
2021
},
2122
"eslintConfig": {
2223
"extends": "react-app"
@@ -49,6 +50,7 @@
4950
"rimraf": "^4.3.1",
5051
"ts-loader": "^9.4.2",
5152
"typescript": "^4.9.5",
53+
"webpack": "^5.88.2",
5254
"webpack-bundle-analyzer": "^4.8.0",
5355
"webpack-cli": "^5.0.1"
5456
}

webdriver-ts-results/tsconfig.json

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
3+
"target": "ES5",
44
"lib": [
5-
"dom",
6-
"dom.iterable",
7-
"esnext"
5+
"DOM",
6+
"DOM.Iterable",
7+
"ESNext"
88
],
99
"noFallthroughCasesInSwitch": true,
10-
"allowJs": true,
1110
"skipLibCheck": true,
1211
"esModuleInterop": true,
13-
"allowSyntheticDefaultImports": true,
1412
"strict": true,
15-
"forceConsistentCasingInFileNames": true,
16-
"module": "esnext",
17-
"moduleResolution": "node",
13+
"module": "ESNext",
14+
"moduleResolution": "Node",
1815
"resolveJsonModule": true,
1916
"isolatedModules": true,
2017
"noEmit": true,
2118
"jsx": "react-jsx",
22-
"typeRoots": [
23-
"./node_modules/@types",
24-
"./src/typings"
25-
]
2619
},
2720
"include": [
2821
"src"
Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,7 @@
11
{
2-
"compilerOptions": {
3-
"target": "es5",
4-
"lib": [
5-
"dom",
6-
"dom.iterable",
7-
"esnext"
8-
],
9-
"allowJs": true,
10-
"skipLibCheck": true,
11-
"esModuleInterop": true,
12-
"allowSyntheticDefaultImports": true,
13-
"strict": true,
14-
"forceConsistentCasingInFileNames": true,
15-
"module": "esnext",
16-
"moduleResolution": "node",
17-
"resolveJsonModule": true,
18-
"isolatedModules": true,
19-
"noEmit": false,
20-
"jsx": "react"
21-
},
22-
"include": [
23-
"src"
24-
]
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": false,
5+
"jsx": "react"
6+
}
257
}

webdriver-ts-results/webpack.config.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
var HtmlWebpackPlugin = require('html-webpack-plugin');
2-
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
3-
var InlineChunkHtmlPlugin = require('inline-chunk-html-plugin');
1+
import HtmlWebpackPlugin from 'html-webpack-plugin';
2+
// const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer');
3+
import InlineChunkHtmlPlugin from 'inline-chunk-html-plugin';
4+
import path from 'path';
5+
import { fileURLToPath } from 'url';
46

5-
var path = require('path')
6-
var cache = true;
7-
var loaders = [
7+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
8+
9+
const loaders = [
810
{
9-
test: /\.tsx$|\.ts$/,
11+
test: /\.tsx?$/,
1012
loader: 'ts-loader',
1113
exclude: /node_modules/,
1214
options: {
@@ -18,11 +20,9 @@ var loaders = [
1820
use: [{ loader: "style-loader" }, { loader: "css-loader" }],
1921
}
2022
];
21-
var extensions = [
22-
'.ts', '.tsx', '.ts', '.js'
23-
];
2423

25-
module.exports = [{
24+
/** @type {import("webpack").Configuration} */
25+
export default [{
2626
cache: true,
2727
module: {
2828
rules: loaders
@@ -53,7 +53,7 @@ module.exports = [{
5353
}
5454
},
5555
resolve: {
56-
extensions: extensions,
56+
extensions: [".js", ".ts", ".tsx"],
5757
modules: [
5858
__dirname,
5959
path.resolve(__dirname, "src"),

0 commit comments

Comments
 (0)