Below is the top of my fuse.ts file
import { CSSPluginOptions } from 'fuse-box/plugins/stylesheet/CSSplugin';
import { argv } from 'yargs';
import * as path from 'path';
import {
CSSPlugin, CSSResourcePlugin, EnvPlugin, FuseBox, QuantumPlugin,
SassPlugin, Sparky, WebIndexPlugin, CopyPlugin, CSSModules
} from 'fuse-box';
import { SparkyFile } from 'fuse-box/sparky/SparkyFile';
import * as fs from 'fs';
const express = require('express');
class SparkyContext
{
I am getting the following error
import { argv } from 'yargs';
^
SyntaxError: Unexpected token {
So the first import statement is fine and then it complains about the second one. Tried moving some imports around and most of them have the same error complaining about either * or { unexpected after the import.
My tsconfig.json is below and quite basic and standard.
{
"compilerOptions": {
"baseUrl": "./src",
"jsx": "react",
"target": "es5",
"module": "es2015",
"sourceMap": true,
"importHelpers": false,
"removeComments": true,
"moduleResolution": "node",
"lib": ["es2015", "es2015.iterable", "dom"],
"experimentalDecorators": true,
"allowSyntheticDefaultImports" : true
}
}
Not too sure what the issue is and not sure where to look. If I do change them to require statements it works though. So seems like it isn't liking the tsconfig.json for some reason. And there is no overriding properties in package.json or anything else that could be causing an issue.
ts-node -F -O '{\"module\": \"commonjs\"}' ./fuse.ts serve
Adding the compiler options here worked. Bit strange that they were necessary here. Might be because of a global install of ts-node and might not be picking up my tsconfig.json in the project.
Will do a bit more research and update accordingly but in the meantime this has allowed me to move on :)