Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit 7b0562a

Browse files
authored
fix: running typescript in node (#308)
1 parent 8b6cb15 commit 7b0562a

14 files changed

Lines changed: 38 additions & 6 deletions

File tree

aw.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ module.exports = {
8585
['@babel/preset-env', {
8686
targets: {
8787
browsers: ['last 2 versions', 'safari >= 7'],
88+
node: 'current',
8889
},
89-
modules: false,
90+
modules: cmd !== 'chrome' ? 'commonjs' : false,
9091
}],
9192
],
9293
},

commands-common/transform/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function getBabelOpts(filename, argv) {
1818

1919
function transformTypescript(filePath, sourceRoot, tsContent, argv) {
2020
const { babel: { typescript } } = argv;
21-
const { transform: { typescript: { compilerOptions, babelOptions } } } = argv;
21+
const { transform: { typescript: { compilerOptions = {}, babelOptions = {} } = {} } = {} } = argv;
2222
const fileName = filePath;
2323
compilerOptions.sourceRoot = sourceRoot;
2424
compilerOptions.inlineSources = true;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## From the project root run
44

55
```shell
6-
npm run test
6+
npm run test:node
77
```
88

99
![](./node.gif)
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
2-
"name": "@after-work.js/example-node",
2+
"name": "@after-work.js/example-node-js",
33
"private": true,
44
"version": "5.0.0-beta.2",
5-
"description": "File utils",
6-
"main": "src/index.js",
5+
"description": "Node example with javascript",
76
"scripts": {
87
"lint": "eslint test"
98
},
File renamed without changes.

0 commit comments

Comments
 (0)