IMPR: Add ts-loader

This commit is contained in:
Tony Air 2021-09-12 22:49:47 +02:00
parent 92e8cfa5b5
commit ff5f84f500
3 changed files with 166 additions and 165 deletions

View File

@ -172,6 +172,8 @@
"terser-webpack-plugin": "^5.2.3",
"ts-invariant": "^0.9.1",
"tslib": "^2.3.1",
"ts-loader": "^9.2.5",
"typescript": "^4.4.3",
"url": "^0.11.0",
"url-loader": "^4.1.1",
"webpack": "^5.52.0",

View File

@ -6,10 +6,9 @@ const conf = common.configuration;
const webpack = require('webpack');
const {
merge
merge,
} = require('webpack-merge');
const fs = require('fs');
const path = require('path');
@ -204,7 +203,7 @@ const cfg = merge(common.webpack, {
'default',
{
discardComments: {
removeAll: true
removeAll: true,
},
zindex: true,
cssDeclarationSorter: true,
@ -221,7 +220,7 @@ const cfg = merge(common.webpack, {
minify: [
CssMinimizerPlugin.cssnanoMinify,
//CssMinimizerPlugin.cleanCssMinify,
]
],
}),
],
},
@ -233,7 +232,7 @@ const cfg = merge(common.webpack, {
},
module: {
rules: [{
rules: [{ test: /\.tsx?$/, loader: 'ts-loader' }, {
test: /\.jsx?$/,
//exclude: /node_modules/,
use: {
@ -250,7 +249,7 @@ const cfg = merge(common.webpack, {
},
], //Preset used for env setup
plugins: [
['@babel/transform-react-jsx']
['@babel/transform-react-jsx'],
],
cacheDirectory: true,
cacheCompression: true,
@ -280,15 +279,15 @@ const cfg = merge(common.webpack, {
},
{
test: /fontawesome([^.]+).(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
type: "asset/resource",
type: 'asset/resource',
},
{
test: /\.(ttf|otf|eot|woff(2)?)$/,
type: "asset/resource",
type: 'asset/resource',
},
{
test: /\.(png|webp|jpg|jpeg|gif|svg)$/,
type: "javascript/auto",
type: 'javascript/auto',
use: [{
loader: 'img-optimize-loader',
options: {

View File

@ -10,7 +10,7 @@ const fs = require('fs');
//const autoprefixer = require('autoprefixer');
const webpack = require('webpack');
const {
merge
merge,
} = require('webpack-merge');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
@ -54,7 +54,7 @@ const config = merge(common.webpack, {
},
module: {
rules: [{
rules: [{ test: /\.tsx?$/, loader: 'ts-loader' }, {
test: /\.jsx?$/,
//exclude: /node_modules/,
use: {
@ -103,14 +103,14 @@ const config = merge(common.webpack, {
},
{
test: /fontawesome([^.]+).(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
type: "asset/resource",
type: 'asset/resource',
},
{
test: /\.(gif|png|jpg|jpeg|ttf|otf|eot|svg|webp|woff(2)?)$/,
type: "asset/resource",
type: 'asset/resource',
}, {
test: /\.(png|webp|jpg|jpeg|gif|svg)$/,
type: "asset/resource",
type: 'asset/resource',
},],
},
plugins: plugins,