app-module-path-node icon indicating copy to clipboard operation
app-module-path-node copied to clipboard

app-module-path not working with webpack?

Open Gattermeier opened this issue 9 years ago • 3 comments

I am using webpack to transpile my build. Seems to me app-module-path doesn't work when using webpack for builds?

Gattermeier avatar Apr 07 '16 20:04 Gattermeier

FYI, not using app-module-path, you can of course resolve via Webpack config: resolve: { modulesDirectories: [ 'src', 'node_modules' ], extensions: ['', '.js', '.jsx'] },

It just would be nice to have a catch all solution.

Gattermeier avatar Apr 07 '16 20:04 Gattermeier

Sounds like Webpack chose to use its own module resolving logic instead of using the the logic that Node.js provides internally. I don't think that was a good decision, but if you have any thoughts on how we can accommodate Webpack please share.

patrick-steele-idem avatar Apr 07 '16 21:04 patrick-steele-idem

Webpack has this functionality built-in. There's a "resolve" section in their docs. You just have to configure webpack with the same base dir that you used in your .addPath(baseDir)

// in webpack.config.js
{
  ...
  resolve: {
    alias: {
      client: myClientBaseDir,
      server: myServerBaseDir,
      ...etc
    }
  },
  ...
}

d-oliveros avatar Jun 23 '16 08:06 d-oliveros