baldore / open-browser-webpack-plugin

Opens a new browser tab when Webpack loads.
119 stars 27 forks source link

Will not launch browser... #2

Open dantullis opened 8 years ago

dantullis commented 8 years ago

I cannot get this to launch a new browser or a new tab.

How to reproduce this: I downloaded the "example react-router project"(https://github.com/rackt/react-router), and webpack loads everything fine and I can navigate to localhost:8080 and all works well. However, when i install open-browser-webpack-plugin, add the plugin to "webpack.config.babel.js", and then restart webpack nothing happens. There is no new browser launch or new tab opened.

Here is what I added to "webpack.config.babel.js": new OpenBrowserPlugin({ url: 'http://localhost:8080' })

So, the section looks like this:

plugins: [
  new webpack.optimize.OccurenceOrderPlugin(),
  new webpack.DefinePlugin({'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)}),
  new OpenBrowserPlugin({ url: 'http://localhost:8080' })    
]
baldore commented 8 years ago

Are you having any errors in the console? Looks like the tab only opens when Webpack doesn't display any error. Working on it.

dantullis commented 8 years ago

No error in the console. Just double checked. The open open tab is the google homepage. Here is the contents of webpack.config.babel.js in case it helps:

import webpack from 'webpack'
import OpenBrowserPlugin from 'open-browser-webpack-plugin'

export default {

output: {
    library: 'ReactRouter',
    libraryTarget: 'umd'
},

externals: [
    {
        react: {
            root: 'React',
            commonjs2: 'react',
            commonjs: 'react',
            amd: 'react'
        }
    }
],

module: {
    loaders: [
        {
            test: /\.js$/,
            exclude: /node_modules/,
            loader: 'babel'
        }
    ]
},

node: {
    Buffer: false
},

plugins: [
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.DefinePlugin({'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)}),
    new OpenBrowserPlugin({
        url: 'http://localhost:8080'
    })
]

}
baldore commented 8 years ago

Try setting ignoreErrors in the configuration (requires version 0.0.2).