Closed 8Observer8 closed 2 years ago
I tried to copy all settings from the box2d.ts/tsconfig.json and compilation is okay but now Browserify cannot bundle it:
browserify public/js/main.js -o public/js/bundle.js
E:\_Projects\Physics\box2d-core\typescript-webgl-example\public\js\main.js:1
import { b2World } from "@box2d/core";
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
{
"compilerOptions": {
"target": "ES2018",
"outDir": "../public/js",
"sourceMap": false,
"lib": [
"ES2018",
"DOM"
],
"types": [
"node"
],
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"moduleResolution": "node",
"declaration": true,
"strict": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"declarationMap": true
},
"include": [
"../src/**/*.ts"
],
"exclude": [
"node_modules"
]
}
I solved this problem. I added only this line:
"skipLibCheck": true
It works:
{
"compilerOptions": {
"target": "ES5",
"outDir": "../public/js",
"sourceMap": false,
"types": [
"node"
],
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true
},
"include": [
"../src/**/*.ts"
],
"exclude": [
"node_modules"
]
}
Yes, skipLibCheck is the quick-fix. I'll check if I can fix this without the user needing to add this flag.
I have just released a new version, which should fix the issues. Can you try again without skipLibCheck?
Yes, 0.9.2 works without skipLibCheck
Thanks for checking.
How to solve this problem?