Working Babel transpiling

This commit is contained in:
modeco80 2023-01-29 19:59:45 -05:00
parent 65ac88f771
commit 3c17e457d6
4 changed files with 52 additions and 7 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
node_modules/ node_modules/
dist/*.js dist/*.js
dist/*.js.LICENSE.txt

17
babel.config.json Normal file
View file

@ -0,0 +1,17 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"edge": "17",
"firefox": "60",
"chrome": "67",
"safari": "11.1"
},
"useBuiltIns": "usage",
"corejs": "3.6.5"
}
]
]
}

View file

@ -14,5 +14,10 @@
"serve": "^14.2.0", "serve": "^14.2.0",
"webpack": "^5.75.0", "webpack": "^5.75.0",
"webpack-cli": "^5.0.1" "webpack-cli": "^5.0.1"
},
"devDependencies": {
"@babel/core": "^7.20.12",
"@babel/preset-env": "^7.20.2",
"babel-loader": "^9.1.2"
} }
} }

View file

@ -1,9 +1,31 @@
const path = require("path"); const path = require("path");
module.exports = { module.exports = {
entry: "./src/index.js", entry: "./src/index.js",
output: {
filename: 'main.js', output: {
path: path.resolve(__dirname, 'dist'), filename: 'main.js',
}, path: path.resolve(__dirname, 'dist'),
mode: "production" },
module: {
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env'
]
]
}
}
}
]
},
mode: "production"
} }