Our project is using the webpack resolve.root
option to import modules with absolute paths. (avoiding something like ../../../module
)
In its current state the project is using babel-loader which works perfectly fine.
My task is to migrate the app to Angular 2.
Therefor I am currently in the process of transitioning to TypeScript.
Somehow it seems like the ts-loader does not work in combination with the resolve.root
option of the webpack config.
Example of the webpack.config.js
resolve: {
root: [
path.resolve('./node_modules'),
path.resolve('./app'),
path.resolve('./app/lib'),
]
},
Example of a module import
import AbstractListState from 'states/abstract_list_state';
The states
directory is inside the app/lib
directory.
Error when executing webpack
ERROR in ./app/mainViews/panel/panel.controller.ts
Module not found: Error: Cannot resolve module 'states/abstract_list_state' in C:\Users\...\Project\app\mainViews\panel
@ ./app/mainViews/panel/panel.controller.ts 4:28-65
tsconfig.json
file will be implemented in TypeScript 2. Apparently, you can already test it today withtypescript@next
. – Robbierobbin