andrey-skl / ng-annotate-loader

Webpack loader to annotate angular applications
MIT License
120 stars 28 forks source link

Issue with npm linked module. #18

Closed asleepinglion closed 8 years ago

asleepinglion commented 8 years ago

Hey there! I recently was working with a module that was installed via npm link during development. I have the following webpack config for js:

  {
    test: /\.js$/,
    loader: 'ng-annotate!babel?compact=true&presets='+require.resolve('babel-preset-es2015')
  },

Everything was working fine until I enabled source maps. I started getting an error inside the source-map dependency of ng-annotate. When npm installed the path that was being passed down was the nested node_modules path and when the it was npm linked, it was the root path to the module elsewhere on disk. Inside source-map they were using their own mechanism for determining the relative path between two directories and it wasn't checking for a common root, and was failing returning an absolute path.

When I swapped it out for the native path.relative everything worked fine. It appears this has been resolved in the latest version of source-map. I've created a fork with the updated package dependency. Everything seems to be working fine. Created this issue to submit the PR. Thanks for the library!