我试图将我的项目分成两个单独的项目,然后在它们之间重用文件。
在运行时出现以下错误SyntaxError: Unexpected token export
-export {Helper} from './src/xx/hepler’;
使用辅助类的类。
import { Helper } from ‘sub-project’;
// const Helper = require (‘sub-project’); also tried this
package.json
"devDependencies": {
"sub-project": "file:../../sub-project/e2e"
}
app.ts
export {Helper} from './src/xx/helper’;
helper.ts
export class Helper {
}
package.json
"name": "sub-project",
"main": "app.ts"
tsconfig.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": ".",
"target": "es5",
"module": "commonjs",
"types": [
],
}
}