My project structure:
/website /node /node_module <<-- library root /type_src <<-- ts files /src <<-- compiled js files
Previously, I could automatically import node root modules as follows:
/type_src/store/BaseStore.ts:
import {observer} from "mobx-react/native"; @observer class BaseStore{ }
But recently, automatic imports have created relative paths for these node modules:
import {observer} from "../../node_modules/mobx-react/index"; @observer class BaseStore{ }
The only way to generate import {observer} from "mobx-react/native"; is waiting for the appearance of this red light bulb, which is not so convenient.
I created another project, and it works great, but I have no idea why this project suddenly ran into this problem. Can someone help me sort this out?
TSconfig:
{ "compilerOptions": { "module": "commonjs", "target": "es6", "moduleResolution": "node", "removeComments": true, "allowSyntheticDefaultImports": true, "noImplicitAny": false, "sourceMap": true, "outDir": "./src", "jsx": "react", "experimentalDecorators": true, "noLib": false, "declaration": false, "emitDecoratorMetadata": true, "lib": ["es6", "dom"], "types": ["reflect-metadata"] }, "exclude": [ "node_modules" ] }


Redgiant
source share