Skip to content

Commit 481885e

Browse files
committed
Update packages and build configs
1 parent 8857cc3 commit 481885e

File tree

9 files changed

+1448
-6227
lines changed

9 files changed

+1448
-6227
lines changed

docs/src/index.template.ejs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
<body>
1414
<div id="Docs"></div>
15-
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=default,Array.prototype.includes,Array.prototype.find,Array.prototype.findIndex"></script>
15+
<script
16+
src="https://cdn.polyfill.io/v3/polyfill.js?features=default,Array.prototype.includes,Array.prototype.find,Array.prototype.findIndex"></script>
1617
</body>
1718

1819
</html>

docs/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const DEFAULT_ROOT = '/introduction/getting-started';
2121

2222
m.route.prefix = '#';
2323

24-
const resolveRoute = (wrapper: m.Component) => ({
24+
const resolveRoute = (wrapper: m.Component<IDocumentationData>) => ({
2525
onmatch(attrs, requestedPath) {
2626
attrs.docs = docs;
2727
attrs.requestedPath = requestedPath;

docs/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
4-
"baseUrl": "../",
54
"declaration": false,
6-
"outDir": "./dist",
75
"module": "commonjs",
6+
"resolveJsonModule": true
87
},
98
"include": [
109
"./src",

docs/webpack.config.js

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
const path = require('path');
22
const webpack = require('webpack');
3-
const TerserPlugin = require("terser-webpack-plugin");
43
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
5-
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
6-
const HtmlWebpackPlugin = require('html-webpack-plugin');
7-
const { CheckerPlugin } = require('awesome-typescript-loader');
4+
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
5+
const HTMLPlugin = require('html-webpack-plugin');
86
const packageJson = require('../package.json');
97

108
const APP_TITLE = `Construct-ui: ${packageJson.description} - v${packageJson.version}`;
@@ -14,24 +12,31 @@ const PORT = 9000;
1412

1513
const plugins = {
1614
common: [
17-
new HtmlWebpackPlugin({
15+
new HTMLPlugin({
1816
title: APP_TITLE,
1917
template: TEMPLATE_PATH
2018
}),
2119
new webpack.DefinePlugin({
20+
'process.env.NODE_ENV': JSON.stringify(isProduction ? "production" : "development"),
21+
'process.env.NODE_DEBUG': JSON.stringify(isProduction ? "production" : "development"),
2222
VERSION: JSON.stringify(packageJson.version),
2323
})
2424
],
2525
production: [
2626
new MiniCssExtractPlugin({
27-
filename: "[name].[hash].css",
28-
chunkFilename: "[id].[hash].css"
27+
filename: "[name].[fullhash].css",
28+
chunkFilename: "[id].[fullhash].css"
2929
}),
30-
new OptimizeCSSAssetsPlugin(),
31-
new TerserPlugin()
3230
],
3331
development: [
34-
new CheckerPlugin(),
32+
new ForkTsCheckerWebpackPlugin({
33+
typescript: {
34+
diagnosticOptions: {
35+
semantic: true,
36+
syntactic: true,
37+
},
38+
},
39+
})
3540
]
3641
}
3742

@@ -58,17 +63,23 @@ const cssLoader = {
5863
'style-loader',
5964
'css-loader',
6065
'resolve-url-loader',
61-
'sass-loader?sourceMap'
66+
{
67+
loader: 'sass-loader',
68+
options: {
69+
sourceMap: true
70+
}
71+
}
6272
]
6373
}
6474

75+
/** @type {import('webpack').Configuration} */
6576
module.exports = {
6677
mode: isProduction ? 'production' : 'development',
6778
entry: {
6879
app: './src/index.ts'
6980
},
7081
output: {
71-
filename: isProduction ? 'app-[hash].js' : 'app.js',
82+
filename: isProduction ? 'app-[fullhash].js' : 'app.js',
7283
path: path.resolve(__dirname, 'public')
7384
},
7485
module: {
@@ -89,36 +100,28 @@ module.exports = {
89100
{
90101
test: /\.ts?$/,
91102
exclude: /node_modules/,
92-
use: {
93-
loader: 'awesome-typescript-loader',
94-
options: {
95-
useCache: true,
96-
forceIsolatedModules: true
97-
}
103+
loader: 'ts-loader',
104+
options: {
105+
transpileOnly: true
98106
}
99107
}
100108
]
101109
},
102110
plugins: plugins.common.concat(isProduction ? plugins.production : plugins.development),
103-
devtool: isProduction ? undefined : 'cheap-eval-source-map',
111+
devtool: isProduction ? 'source-map' : 'eval-cheap-source-map',
104112
resolve: {
105113
extensions: ['.ts', '.js'],
106114
alias: {
107115
'@shared': path.resolve(__dirname, '../src/_shared'),
108116
'@': path.resolve(__dirname, '../src')
109117
}
110118
},
111-
optimization: isProduction ? {} : {
112-
removeAvailableModules: false,
113-
removeEmptyChunks: false,
114-
splitChunks: false
115-
},
119+
stats: isProduction ? undefined : "minimal",
116120
devServer: {
117121
port: PORT,
118-
stats: 'errors-only',
119122
open: true,
120-
watchOptions: {
121-
ignored: /node_modules/
122-
}
123+
},
124+
watchOptions: {
125+
ignored: '**/node_modules'
123126
}
124127
}

0 commit comments

Comments
 (0)