Skip to content

Commit

Permalink
feat: use babel to transpile runtime (ts => cjs)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 19, 2020
1 parent 57ce7f8 commit 82dac22
Show file tree
Hide file tree
Showing 4 changed files with 998 additions and 22 deletions.
8 changes: 8 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
presets: [
'@babel/preset-typescript'
],
plugins: [
'@babel/plugin-transform-modules-commonjs'
]
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
],
"scripts": {
"build": "yarn clean && siroc build && yarn build:runtime",
"build:runtime": "tsc --build tsconfig.runtime.json",
"clean": "rm -rf dist lib",
"build:runtime": "babel --extensions .ts src.runtime --out-dir runtime",
"clean": "rm -rf dist lib runtime",
"lint": "eslint --ext ts .",
"release": "yarn build && standard-version && npm publish && git push --follow-tags"
},
Expand All @@ -28,6 +28,10 @@
"util": "^0.12.3"
},
"devDependencies": {
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"@babel/plugin-transform-modules-commonjs": "^7.12.1",
"@babel/preset-typescript": "^7.12.1",
"@nuxtjs/eslint-config-typescript": "latest",
"@types/node": "latest",
"@types/node-fetch": "^2.5.7",
Expand Down
2 changes: 1 addition & 1 deletion src.runtime/global.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default ((typeof globalThis !== 'undefined')
module.exports = ((typeof globalThis !== 'undefined')
? globalThis
: (typeof self !== 'undefined')
? self
Expand Down
Loading

0 comments on commit 82dac22

Please sign in to comment.