mirror of
https://github.com/a2nt/webpack-bootstrap-ui-kit.git
synced 2024-10-22 11:05:45 +02:00
IMPR: Add ts-loader
This commit is contained in:
parent
92e8cfa5b5
commit
ff5f84f500
@ -172,6 +172,8 @@
|
|||||||
"terser-webpack-plugin": "^5.2.3",
|
"terser-webpack-plugin": "^5.2.3",
|
||||||
"ts-invariant": "^0.9.1",
|
"ts-invariant": "^0.9.1",
|
||||||
"tslib": "^2.3.1",
|
"tslib": "^2.3.1",
|
||||||
|
"ts-loader": "^9.2.5",
|
||||||
|
"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.0",
|
||||||
|
@ -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');
|
||||||
|
|
||||||
@ -130,7 +129,7 @@ common.themes.forEach((theme) => {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
|
||||||
.BundleAnalyzerPlugin;
|
.BundleAnalyzerPlugin;
|
||||||
@ -204,7 +203,7 @@ const cfg = merge(common.webpack, {
|
|||||||
'default',
|
'default',
|
||||||
{
|
{
|
||||||
discardComments: {
|
discardComments: {
|
||||||
removeAll: true
|
removeAll: true,
|
||||||
},
|
},
|
||||||
zindex: true,
|
zindex: true,
|
||||||
cssDeclarationSorter: true,
|
cssDeclarationSorter: true,
|
||||||
@ -217,11 +216,11 @@ const cfg = merge(common.webpack, {
|
|||||||
discardDuplicates: true,
|
discardDuplicates: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}, ],
|
},],
|
||||||
minify: [
|
minify: [
|
||||||
CssMinimizerPlugin.cssnanoMinify,
|
CssMinimizerPlugin.cssnanoMinify,
|
||||||
//CssMinimizerPlugin.cleanCssMinify,
|
//CssMinimizerPlugin.cleanCssMinify,
|
||||||
]
|
],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -233,7 +232,7 @@ 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: {
|
||||||
@ -250,7 +249,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,
|
||||||
@ -276,19 +275,19 @@ const cfg = merge(common.webpack, {
|
|||||||
options: {
|
options: {
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
},
|
},
|
||||||
}, ],
|
},],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /fontawesome([^.]+).(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
|
test: /fontawesome([^.]+).(ttf|otf|eot|svg|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',
|
||||||
options: {
|
options: {
|
||||||
@ -324,12 +323,12 @@ const cfg = merge(common.webpack, {
|
|||||||
limit: 1,
|
limit: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, ],
|
},],
|
||||||
}, ],
|
},],
|
||||||
},
|
},
|
||||||
|
|
||||||
plugins: plugins,
|
plugins: plugins,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(cfg);
|
console.log(cfg);
|
||||||
module.exports = cfg;
|
module.exports = cfg;
|
||||||
|
@ -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');
|
||||||
@ -54,7 +54,7 @@ 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: {
|
||||||
@ -99,19 +99,19 @@ const config = merge(common.webpack, {
|
|||||||
options: {
|
options: {
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
},
|
},
|
||||||
}, ],
|
},],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /fontawesome([^.]+).(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
|
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)?)$/,
|
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)$/,
|
test: /\.(png|webp|jpg|jpeg|gif|svg)$/,
|
||||||
type: "asset/resource",
|
type: 'asset/resource',
|
||||||
}, ],
|
},],
|
||||||
},
|
},
|
||||||
plugins: plugins,
|
plugins: plugins,
|
||||||
|
|
||||||
@ -132,6 +132,6 @@ const config = merge(common.webpack, {
|
|||||||
'service-worker-allowed': '/',
|
'service-worker-allowed': '/',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
Loading…
Reference in New Issue
Block a user