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

version 2.0 issue with output.path #473

Closed
kentcdodds opened this issue May 3, 2016 · 6 comments
Closed

version 2.0 issue with output.path #473

kentcdodds opened this issue May 3, 2016 · 6 comments

Comments

@kentcdodds
Copy link
Member

I'm using [email protected] (latest beta) and [email protected] and having trouble with output.path. I set output.path to a dist directory. When I run webpack. The bundle gets generated and placed in the dist directory as expected. But when I run webpack-dev-server the bundle is served from the root (as if no output.path is specified). Any ideas?

Here's a repo that reproduces the issue.

Here's the webpack.config.js:

const {resolve} = require('path')
module.exports = {
  entry: './js/app.js',
  output: {
    filename: 'bundle.js',
    path: resolve(__dirname, 'dist'),
    pathinfo: true,
  },
  context: __dirname,
  devtool: 'eval',
  module: {
    loaders: [
      {test: /\.js$/, loader: 'babel!eslint', exclude: /node_modules/},
      {test: /\.css$/, loader: 'style!css'},
    ],
  },
}

Here's a gif demonstrating the issue:

problem

Let me know if you need any more information. I'm in the process of creating a video course about Webpack and I'll be using Webpack 2. I'd really like this to work. Help is definitely appreciated! Let me know if there's anything I can do! Happy to submit a PR with a little direction.

@kentcdodds
Copy link
Member Author

kentcdodds commented May 3, 2016

Ok, so I worked around it by using --content-base as @xyyjk suggested, but was also required to add a prebuild and prestart script which deletes the dist and copies the index.html and favicon.ico over to the dist directory as well. I still feel like this behavior could be a bug though, so I'll leave the issue open.

@LegNeato
Copy link

LegNeato commented May 3, 2016

Sounds like the same as webpack/webpack#2376... can you try that patch and see if it fixes it?

@kentcdodds
Copy link
Member Author

Thanks for looking into this @LegNeato! Unfortunately it doesn't appear to solve my issue :-( https://github.com/kentcdodds/es6-todomvc/pull/2/files

@LegNeato
Copy link

LegNeato commented May 4, 2016

Ah, darn...the symptoms sounded a bit similar :-(

@SpaceK33z
Copy link
Member

SpaceK33z commented Sep 3, 2016

Hey @kentcdodds, I think this is actually a dupe of #337. It seems that the CLI does something like output.path = '/'.

Could you confirm this?

@kentcdodds
Copy link
Member Author

Hi @SpaceK33z! It's been a while, and I got it working eventually. I'm thinking this is a dupe of #337, so I'm going to close this one. Thanks!

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

3 participants