s-panferov / awesome-typescript-loader

Awesome TypeScript loader for webpack
Other
2.35k stars 179 forks source link

'Cannot find module' when compile from node_modules #636

Open olgadolg opened 5 years ago

olgadolg commented 5 years ago

My app compiles, but if add it to node_modules, I can't use import * as styles from './styles.scss'; (need to compile together)

tsconfig:

  "compilerOptions": {
    "noImplicitAny": false,
    "outDir": "./dist/",
    "baseUrl": "./src",
    "resolveJsonModule": true,
    "module": "es6",
    "target": "esnext",
    "moduleResolution": "node",
    "jsx": "react",
    "allowJs": true,
    "experimentalDecorators": true
  },
  "include": [
    "./src/**/*"
  ],
  "exclude": [
    "node_modules/!(@my)",
    "**/*.js",
    "**/*.jsx"
  ]
}

definition.d.ts (in my-app):

    const content: Object;
    export = content;
}
declare module '@my/services/utils';

'@my/services/utils' works fine