Use babel to transpile.
This commit is contained in:
parent
6edd037f8d
commit
f4ab8f212e
|
@ -1,12 +1,20 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.14.2",
|
||||
"@babel/eslint-parser": "^7.14.2",
|
||||
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
||||
"@babel/plugin-proposal-decorators": "^7.14.2",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.14.2",
|
||||
"@babel/plugin-transform-runtime": "^7.14.2",
|
||||
"@babel/preset-env": "^7.14.2",
|
||||
"@types/prismjs": "^1.16.5",
|
||||
"@types/uikit": "^3.3.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.23.0",
|
||||
"@typescript-eslint/parser": "^4.23.0",
|
||||
"babel-loader": "^8.2.2",
|
||||
"clipboard": "^2.0.8",
|
||||
"codejar": "^3.4.0",
|
||||
"core-js": "^3.12.1",
|
||||
"css-loader": "^5.2.4",
|
||||
"date-fns": "^2.21.3",
|
||||
"eslint": "^7.26.0",
|
||||
|
|
|
@ -7,14 +7,62 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|||
const { GitRevisionPlugin } = require('git-revision-webpack-plugin');
|
||||
const gitRevisionPlugin = new GitRevisionPlugin();
|
||||
|
||||
|
||||
var babelOptions = {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"corejs": { "version": 3 },
|
||||
"useBuiltIns": "usage",
|
||||
"targets": {
|
||||
"edge": "17",
|
||||
"firefox": "60",
|
||||
"chrome": "67",
|
||||
"safari": "11.1",
|
||||
"ie": "11"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
["@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": true }],
|
||||
["@babel/plugin-proposal-class-properties"],
|
||||
["@babel/transform-runtime"]
|
||||
]
|
||||
};
|
||||
|
||||
const VERBOSE = Object.getOwnPropertyNames(process.env).includes("VERBOSE") || !true;
|
||||
const MODE = process.env.WEBPACK_MODE || "production"
|
||||
const MODE = process.env.WEBPACK_MODE || "production"
|
||||
const DEBUG = MODE != "production";
|
||||
|
||||
let commitHash = gitRevisionPlugin.commithash();
|
||||
|
||||
let devrules = [{ test: /\.tsx?$/, loader: "ts-loader" }];
|
||||
let prodrules = [{
|
||||
test: /\.ts(x?)$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: babelOptions
|
||||
},
|
||||
{
|
||||
loader: 'ts-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: babelOptions
|
||||
}
|
||||
]
|
||||
}];
|
||||
|
||||
console.log("DEBUG:", DEBUG);
|
||||
|
||||
module.exports = {
|
||||
mode: MODE,
|
||||
|
@ -33,8 +81,8 @@ module.exports = {
|
|||
new MiniCssExtractPlugin(),
|
||||
new HtmlWebpackPlugin({ title: "VaultUI" }),
|
||||
new webpack.DefinePlugin({
|
||||
BUILD_STRING:
|
||||
JSON.stringify(`Built At: ${new Date().toString()} by ${os.userInfo().username}@${os.hostname()} on commit ${commitHash}`),
|
||||
BUILD_STRING:
|
||||
JSON.stringify(`Built At: ${new Date().toString()} by ${os.userInfo().username}@${os.hostname()} on commit ${commitHash}`),
|
||||
})
|
||||
],
|
||||
devServer: {
|
||||
|
@ -55,7 +103,7 @@ module.exports = {
|
|||
"sass-loader"
|
||||
],
|
||||
},
|
||||
{ test: /\.tsx?$/, loader: "ts-loader" }
|
||||
...(DEBUG ? devrules : prodrules),
|
||||
],
|
||||
},
|
||||
};
|
Loading…
Reference in a new issue