Skip to content

Commit

Permalink
use babel.config.js for project wide
Browse files Browse the repository at this point in the history
  • Loading branch information
marmotherder committed Jan 21, 2022
1 parent 7285d11 commit 4e6cdc4
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions scripting/javascript.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ func generateJavascriptScripts(scriptDirs []string) error {
}

buildFiles := map[string][]byte{
".babelrc": []byte(babel),
"index.ts": []byte(index),
"package.json": []byte(packageJson),
"tsconfig.json": []byte(tsconfig),
"webpack.js": []byte(webpack),
"babel.config.js": []byte(babel),
"index.ts": []byte(index),
"package.json": []byte(packageJson),
"tsconfig.json": []byte(tsconfig),
"webpack.js": []byte(webpack),
}

for name, data := range buildFiles {
Expand Down Expand Up @@ -85,15 +85,19 @@ func generateJavascriptScripts(scriptDirs []string) error {
return nil
}

const babel = `{
"presets": [
[
"@babel/preset-env",
{
"browserslistEnv": "> 1%"
}
const babel = `'use strict'
module.exports = function(api) {
api.cache(true);
const presets = [
[
"@babel/preset-env"
]
]
];
return {
presets
}
}`

const index = `require("core-js/stable")
Expand Down Expand Up @@ -160,7 +164,7 @@ function walkDir(walkPath) {
}
if (fs.lstatSync(absPath).isDirectory()) {
walkDir(absPath);
} else if (file !== 'webpack.js' && file.endsWith('.js')) {
} else if (file !== 'webpack.js' && file !== 'babel.config.js' && file.endsWith('.js')) {
entries.push(absPath);
}
})
Expand Down

0 comments on commit 4e6cdc4

Please sign in to comment.