Skip to content
This repository has been archived by the owner on Nov 16, 2019. It is now read-only.

Why it open the browser twice? #21

Open
asyncatt opened this issue Jul 28, 2017 · 2 comments
Open

Why it open the browser twice? #21

asyncatt opened this issue Jul 28, 2017 · 2 comments

Comments

@asyncatt
Copy link

first open http://localhost:7760/undefined and then open http://localhost:7760/client.

Here is my code :

new OpenBrowserPlugin({ url: `http://localhost:${devServer.port}/client` })
@fangwentian
Copy link

same issue with you

@viunyrk
Copy link

viunyrk commented Jul 23, 2018

In my case it opens correctly, but 2 tabs.
Here is my config
`const browserConfig = {
...config,
context: path.resolve(__dirname, 'src', 'client'),
entry: ['webpack-hot-middleware/client', 'babel-polyfill', './client.js'],
output: {
path: path.resolve(dirname, 'public'),
filename: 'bundle.js',
hotUpdateChunkFilename: 'hot/hot-update.js',
hotUpdateMainFilename: 'hot/hot-update.json',
publicPath: '/',
},
module: {
rules: [
{ test: /.js$/, include: /src/, loader: 'babel-loader' },
{
test: /^((?!bootstrap.min).)*.css$/,
use: [{
loader: 'style-loader', // inject CSS to page
}, {
loader: 'css-loader',
options: {
modules: true,
importLoaders: 1,
localIdentName: '[path][name]
[local]--[hash:base64:5]'
}
}, {
loader: 'postcss-loader', // Run post css actions
options: {
sourceMap: true,
plugins () { // post css plugins, can be exported to postcss.config.js
return [
require('postcss-cssnext')(),
require('postcss-nesting')(),
require('postcss-nested')(),

                        ];
                    }
                }
            }]
        }, {
            test: /bootstrap\.min\.css$/,
            use: ['style-loader', 'css-loader']
        },
    ],
},
plugins: [
    new webpack.DefinePlugin({
        __isBrowser__: 'true',
        NODE_ENV: JSON.stringify(NODE_ENV),
    }),
    new CleanWebpackPlugin(['public'], cleanOptions),
    new HtmlWebpackPlugin({
        template: `${__dirname}/src/index.html`,
        inject: 'body'
    }),
    new webpack.HotModuleReplacementPlugin(),
    ...(isDevMode ? [new OpenBrowserPlugin({ url: 'http://localhost:3000' })] : []),
],

};`

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

No branches or pull requests

3 participants