IMPR: Add ts-loader

This commit is contained in:
Tony Air 2021-09-12 22:50:08 +02:00
parent 007b37c1c9
commit e43e13479f
4 changed files with 192 additions and 182 deletions

View File

@ -35,7 +35,7 @@
"@a2nt/ss-bootstrap-ui-webpack-boilerplate-react": "^4.3.0", "@a2nt/ss-bootstrap-ui-webpack-boilerplate-react": "^4.3.0",
"@angular/common": "^12.2.5", "@angular/common": "^12.2.5",
"@angular/core": "^12.2.5", "@angular/core": "^12.2.5",
"@apollo/client": "^3.4.10", "@apollo/client": "^3.4.11",
"@jsanahuja/instagramfeed": "github:jsanahuja/instagramfeed", "@jsanahuja/instagramfeed": "github:jsanahuja/instagramfeed",
"@popperjs/core": "^2.10.1", "@popperjs/core": "^2.10.1",
"aos": "^2.3.4", "aos": "^2.3.4",
@ -45,6 +45,7 @@
"bootbox": "^5.5.2", "bootbox": "^5.5.2",
"bootstrap": "^5.1.1", "bootstrap": "^5.1.1",
"brace-expansion": "^2.0.1", "brace-expansion": "^2.0.1",
"charming": "^3.0.2",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"graphql": "^15.5.3", "graphql": "^15.5.3",
"hammerjs": "^2.0.8", "hammerjs": "^2.0.8",
@ -65,6 +66,7 @@
"rxjs": "^7.3.0", "rxjs": "^7.3.0",
"select2": "^4.0.13", "select2": "^4.0.13",
"setimmediate": "^1.0.5", "setimmediate": "^1.0.5",
"vanilla-calendar": "^1.0.30",
"youtube-embed": "^1.0.0" "youtube-embed": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
@ -72,12 +74,12 @@
"@babel/core": "^7.15.5", "@babel/core": "^7.15.5",
"@babel/eslint-parser": "^7.15.4", "@babel/eslint-parser": "^7.15.4",
"@babel/plugin-proposal-class-properties": "^7.14.5", "@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-object-rest-spread": "^7.14.7", "@babel/plugin-proposal-object-rest-spread": "^7.15.6",
"@babel/plugin-syntax-jsx": "^7.14.5", "@babel/plugin-syntax-jsx": "^7.14.5",
"@babel/plugin-syntax-top-level-await": "^7.14.5", "@babel/plugin-syntax-top-level-await": "^7.14.5",
"@babel/plugin-transform-react-jsx": "^7.14.9", "@babel/plugin-transform-react-jsx": "^7.14.9",
"@babel/plugin-transform-runtime": "^7.15.0", "@babel/plugin-transform-runtime": "^7.15.0",
"@babel/preset-env": "^7.15.4", "@babel/preset-env": "^7.15.6",
"@babel/preset-react": "^7.14.5", "@babel/preset-react": "^7.14.5",
"@babel/runtime": "^7.15.4", "@babel/runtime": "^7.15.4",
"@googlemaps/markerclustererplus": "*", "@googlemaps/markerclustererplus": "*",
@ -89,7 +91,7 @@
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"ansi-html": "^0.0.7", "ansi-html": "^0.0.7",
"ansi-html-community": "^0.0.8", "ansi-html-community": "^0.0.8",
"ansi-regex": "^6.0.0", "ansi-regex": "^6.0.1",
"autoprefixer": "^10.3.4", "autoprefixer": "^10.3.4",
"babel-loader": "^8.2.2", "babel-loader": "^8.2.2",
"classnames": "^2.3.1", "classnames": "^2.3.1",
@ -121,7 +123,7 @@
"img-optimize-loader": "^1.0.7", "img-optimize-loader": "^1.0.7",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"loglevel": "^1.7.1", "loglevel": "^1.7.1",
"mini-css-extract-plugin": "^2.2.2", "mini-css-extract-plugin": "^2.3.0",
"msw": "^0.35.0", "msw": "^0.35.0",
"node-fetch": "^3.0.0", "node-fetch": "^3.0.0",
"object-assign": "^4.1.1", "object-assign": "^4.1.1",
@ -146,20 +148,22 @@
"sass-loader": "^12.1.0", "sass-loader": "^12.1.0",
"scheduler": "^0.20.2", "scheduler": "^0.20.2",
"shallowequal": "^1.1.0", "shallowequal": "^1.1.0",
"strip-ansi": "^7.0.0", "strip-ansi": "^7.0.1",
"style-loader": "^3.2.1", "style-loader": "^3.2.1",
"sucrase": "^3.20.1", "sucrase": "^3.20.1",
"svg-url-loader": "^7.1.1", "svg-url-loader": "^7.1.1",
"symbol-observable": "^4.0.0", "symbol-observable": "^4.0.0",
"terser-webpack-plugin": "^5.2.3", "terser-webpack-plugin": "^5.2.4",
"ts-invariant": "^0.9.1", "ts-invariant": "^0.9.3",
"ts-loader": "^9.2.5",
"tslib": "^2.3.1", "tslib": "^2.3.1",
"typescript": "^4.4.3",
"url": "^0.11.0", "url": "^0.11.0",
"url-loader": "^4.1.1", "url-loader": "^4.1.1",
"webpack": "^5.52.0", "webpack": "^5.52.1",
"webpack-bundle-analyzer": "^4.4.2", "webpack-bundle-analyzer": "^4.4.2",
"webpack-cli": "^4.8.0", "webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.1.1", "webpack-dev-server": "^4.2.0",
"webpack-manifest-plugin": "^4.0.2", "webpack-manifest-plugin": "^4.0.2",
"webpack-merge": "^5.8.0", "webpack-merge": "^5.8.0",
"yarn": "^1.22.11", "yarn": "^1.22.11",

5
tsconfig.json Normal file
View File

@ -0,0 +1,5 @@
{
"compilerOptions": {
"sourceMap": true
}
}

View File

@ -6,10 +6,9 @@ const conf = common.configuration;
const webpack = require('webpack'); const webpack = require('webpack');
const { const {
merge merge,
} = require('webpack-merge'); } = require('webpack-merge');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
@ -242,7 +241,7 @@ const cfg = merge(common.webpack, {
'default', 'default',
{ {
discardComments: { discardComments: {
removeAll: true removeAll: true,
}, },
zindex: true, zindex: true,
cssDeclarationSorter: true, cssDeclarationSorter: true,
@ -259,7 +258,7 @@ const cfg = merge(common.webpack, {
minify: [ minify: [
CssMinimizerPlugin.cssnanoMinify, CssMinimizerPlugin.cssnanoMinify,
//CssMinimizerPlugin.cleanCssMinify, //CssMinimizerPlugin.cleanCssMinify,
] ],
}), }),
], ],
}, },
@ -271,7 +270,8 @@ const cfg = merge(common.webpack, {
}, },
module: { module: {
rules: [{ rules: [
{ test: /\.tsx?$/, loader: 'ts-loader' }, {
test: /\.jsx?$/, test: /\.jsx?$/,
//exclude: /node_modules/, //exclude: /node_modules/,
use: { use: {
@ -288,7 +288,7 @@ const cfg = merge(common.webpack, {
}, },
], //Preset used for env setup ], //Preset used for env setup
plugins: [ plugins: [
['@babel/transform-react-jsx'] ['@babel/transform-react-jsx'],
], ],
cacheDirectory: true, cacheDirectory: true,
cacheCompression: true, cacheCompression: true,
@ -300,13 +300,13 @@ const cfg = merge(common.webpack, {
use: [{ use: [{
loader: MiniCssExtractPlugin.loader, loader: MiniCssExtractPlugin.loader,
options: { options: {
publicPath: "../", publicPath: '../',
}, },
}, },
{ {
loader: 'css-loader', loader: 'css-loader',
options: { options: {
sourceMap: true sourceMap: true,
}, },
}, },
/*{ /*{
@ -315,21 +315,21 @@ const cfg = merge(common.webpack, {
{ {
loader: 'sass-loader', loader: 'sass-loader',
options: { options: {
sourceMap: true sourceMap: true,
}, },
}, },
], ],
}, },
{ {
test: /fontawesome([^.]+).(ttf|otf|eot|woff(2)?)(\?[a-z0-9]+)?$/, test: /fontawesome([^.]+).(ttf|otf|eot|woff(2)?)(\?[a-z0-9]+)?$/,
type: "asset/resource", type: 'asset/resource',
}, },
{ {
test: /\.(ttf|otf|eot|woff(2)?)$/, test: /\.(ttf|otf|eot|woff(2)?)$/,
type: "asset/resource", type: 'asset/resource',
}, { }, {
test: /\.(png|webp|jpg|jpeg|gif|svg)$/, test: /\.(png|webp|jpg|jpeg|gif|svg)$/,
type: "javascript/auto", type: 'javascript/auto',
use: [ use: [
{ {
loader: 'img-optimize-loader', loader: 'img-optimize-loader',

View File

@ -10,7 +10,7 @@ const fs = require('fs');
//const autoprefixer = require('autoprefixer'); //const autoprefixer = require('autoprefixer');
const webpack = require('webpack'); const webpack = require('webpack');
const { const {
merge merge,
} = require('webpack-merge'); } = require('webpack-merge');
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
@ -93,13 +93,14 @@ const config = merge(common.webpack, {
}, },
module: { module: {
rules: [{ rules: [
{ test: /\.tsx?$/, loader: 'ts-loader' }, {
test: /\.jsx?$/, test: /\.jsx?$/,
//exclude: /node_modules/, //exclude: /node_modules/,
use: { use: {
loader: '@sucrase/webpack-loader', //'babel-loader', loader: '@sucrase/webpack-loader', //'babel-loader',
options: { options: {
transforms: ['jsx'] transforms: ['jsx'],
/*presets: [ /*presets: [
'@babel/preset-env', '@babel/preset-env',
'@babel/react', '@babel/react',