open-browser-webpack-plugin icon indicating copy to clipboard operation
open-browser-webpack-plugin copied to clipboard

Will not launch browser...

Open dantullis opened this issue 9 years ago • 3 comments

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' })    
]

dantullis avatar Nov 10 '15 17:11 dantullis

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

baldore avatar Nov 11 '15 01:11 baldore

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'
    })
]

}

dantullis avatar Nov 11 '15 02:11 dantullis

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

baldore avatar Dec 26 '15 14:12 baldore