diff --git a/.gitignore b/.gitignore index 8d829b5..793a671 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ -dist/*.js \ No newline at end of file +dist/*.js +dist/*.js.LICENSE.txt diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 0000000..3f5cbe2 --- /dev/null +++ b/babel.config.json @@ -0,0 +1,17 @@ +{ + "presets": [ + [ + "@babel/preset-env", + { + "targets": { + "edge": "17", + "firefox": "60", + "chrome": "67", + "safari": "11.1" + }, + "useBuiltIns": "usage", + "corejs": "3.6.5" + } + ] + ] +} diff --git a/package.json b/package.json index ff77b75..a2fd94c 100644 --- a/package.json +++ b/package.json @@ -14,5 +14,10 @@ "serve": "^14.2.0", "webpack": "^5.75.0", "webpack-cli": "^5.0.1" + }, + "devDependencies": { + "@babel/core": "^7.20.12", + "@babel/preset-env": "^7.20.2", + "babel-loader": "^9.1.2" } } diff --git a/webpack.config.js b/webpack.config.js index c7f9d4a..cb74887 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,9 +1,31 @@ const path = require("path"); + module.exports = { - entry: "./src/index.js", - output: { - filename: 'main.js', - path: path.resolve(__dirname, 'dist'), - }, - mode: "production" + entry: "./src/index.js", + + output: { + filename: 'main.js', + path: path.resolve(__dirname, 'dist'), + }, + + module: { + rules: [ + { + test: /\.m?js$/, + exclude: /node_modules/, + use: { + loader: 'babel-loader', + options: { + presets: [ + [ + '@babel/preset-env' + ] + ] + } + } + } + ] + }, + + mode: "production" }