Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'alias' default lookup directories #2

Closed
rdrey opened this issue Nov 13, 2012 · 4 comments
Closed

'alias' default lookup directories #2

rdrey opened this issue Nov 13, 2012 · 4 comments

Comments

@rdrey
Copy link
Contributor

rdrey commented Nov 13, 2012

Hey @sokra

I'm trying to replace net with net-chromeify

I've put net-chromeify in ./web_modules/ and this works fine on the command-line: webpack src/ComponentLoader.js temp.js --alias net=net-chromeify

I'm trying to do the same thing with webpack-dev-middleware. My config in main.js is this:

app.use(require('webpack-dev-middleware')(__dirname, "./src/ComponentLoader", {
  webpack: {
    watch: true,
    debug: true,
    publicPrefix: "http://localhost:3000/scripts/",
    output: "bundle.js",
    libary: "ComponentLoader",
    alias: {net: "net-chromeify"} //I've also tried moving it outside the webpack hash
  }
})); 

but it can't seem to find net-chromeify. The error suggests that it's looking for net and not net-chromeify:

ERROR: Cannot find module 'net'
Error: Module "net" not found in context "/Users/rainerdreyer/Workspace/PipeDream/components"
Error: /Users/rainerdreyer/Workspace/PipeDream/node_modules/webpack-dev-middleware/node_modules/webpack/buildin/net is not a directory
@ /Users/rainerdreyer/Workspace/PipeDream/components/ServerEndpoint.js (line 2, column 8)

net is not a directory...

Why is it looking for net and not net-chromeify?

Thanks! :)

@sokra
Copy link
Member

sokra commented Nov 13, 2012

Can you try putting the alias option into the resolve object.

app.use(require('webpack-dev-middleware')(__dirname, "./src/ComponentLoader", {
  webpack: {
    // ...
    resolve: {
      alias: {net: "net-chromeify"}
    }
  }
})); 

@rdrey
Copy link
Contributor Author

rdrey commented Nov 13, 2012

Works! :D Thanks!

The webpack readme.md shows the alias option NOT nested in resolve: {}, is that a bug in the docs?

@rdrey rdrey closed this as completed Nov 13, 2012
@sokra
Copy link
Member

sokra commented Nov 13, 2012

It is correctly nested in to README, but it may be easy to overlook...

@rdrey
Copy link
Contributor Author

rdrey commented Nov 13, 2012

Oh yeah, oops. Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants