Skip to content
This repository was archived by the owner on Dec 28, 2021. It is now read-only.

Commit 405b39f

Browse files
author
Sean Dawson
committed
fix: use correct ES6 module syntax
- Turns out `export default` is not the same as `modules.export = xyz` - The actual equivilant is `export = xyz` with `esModuleInterop` enabled - This is a better form than `modules.export = xyz` because we are able to use the type system - See: https://stackoverflow.com/questions/40294870/module-exports-vs-export-default-in-node-js-and-es6 and https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#weeding-out-errors
1 parent d3fd7d6 commit 405b39f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import * as path from 'path'
22
import * as fs from 'fs-extra'
33
import * as _ from 'lodash'
4-
import * as globby from 'globby'
4+
import globby from 'globby'
55

66
import * as typescript from './typescript'
77
import { watchFiles } from './watchFiles'
88

99
const SERVERLESS_FOLDER = '.serverless'
1010
const BUILD_FOLDER = '.build'
1111

12-
export class TypeScriptPlugin {
12+
class TypeScriptPlugin {
1313
private originalServicePath: string
1414
private isWatching: boolean
1515

@@ -278,4 +278,4 @@ export class TypeScriptPlugin {
278278
}
279279
}
280280

281-
export default TypeScriptPlugin
281+
export = TypeScriptPlugin

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"rootDir": ".",
55
"target": "es6",
66
"sourceMap": true,
7-
"outDir": "dist"
7+
"outDir": "dist",
8+
"esModuleInterop": true
89
},
910
"exclude": [
1011
"node_modules"

0 commit comments

Comments
 (0)