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

An error occurred when i set hot true #89

Closed
Chryseis opened this issue Mar 31, 2018 · 1 comment
Closed

An error occurred when i set hot true #89

Chryseis opened this issue Mar 31, 2018 · 1 comment

Comments

@Chryseis
Copy link

The Issues page for this repository is not a support forum, it is for reporting potential bugs in this module, which
composes webpack-hot-middleware and webpack-dev-middle for use with koa2.
If you have arrived here because you cannot get webpack-hot-middleware
or webpack-dev-middleware working, please review the documentation
for the respective middleware you are experiencing a problem with. If you proceed with this form, please fill out all fields, or your issue may be closed as "invalid." Please remove this header to acknowledge this message.

  • Node Version:9.8.0
  • NPM Version:5.6.0
  • koa Version:2.5.0
  • koa-wepback Version:3.0.2
 {
    devtool: "source-map",
    module: {
        rules: [
            {
                test: /\.(js|jsx)?/,
                include: [
                    path.resolve(__dirname, '../src')
                ],
                exclude: [
                    path.resolve(__dirname, '../node_modules'), path.resolve(__dirname, '../src/index.html')
                ],
                loader: ['babel-loader', 'eslint-loader']
            },
            {
                test: /.(css|less)$/,
                use: ['style-loader', 'css-loader', {loader: 'less-loader', options: { javascriptEnabled: true }}]
            },
            {
                test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
                use: [{
                    loader: 'url-loader',
                    options: {
                        limit: 10000,
                        name: 'static/img/[name][hash:7].[ext]'
                    }
                }]
            },
            {
                test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
                use: [{
                    loader: 'url-loader',
                    options: {
                        limit: 10000,
                        name: 'static/fonts/[name][hash:7].[ext]'
                    }
                }]
            }
        ]
    },
    resolve: {
        extensions: [".js", ".json", ".jsx", ".css", ".less"]
    }
}

merge(baseWebpackConfig, {
    mode: 'development',
    entry: {
        app: ['webpack-hot-middleware/client?reload=true', path.resolve(__dirname, '../src/index')],
        vendor: ['react', 'react-dom', 'dva', 'lodash']
    },
    output: {
        path: path.resolve(__dirname, 'dist'),
        publicPath: '/',
        filename: 'js/[name].js',
        chunkFilename: 'js/[name].js',
        sourceMapFilename: '[file].map'
    },
    optimization: {
        splitChunks: {
            cacheGroups: {
                default: false,
                commons: {
                    test: /react|react-dom|dva|lodash/,
                    name: "vendor",
                    chunks: "all"
                }
            }
        }
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new HtmlWebpackPlugin({
            title: 'AWM',
            favicon: path.resolve(__dirname, '../src/assets/favicon.ico'),
            filename: 'index.html',
            template: path.resolve(__dirname, '../src/index.html'),
            chunks: ['app', 'vendor']
        })
    ]
})

error:
image

@shellscape
Copy link
Owner

koa-webpack does not inject anything into the browser. Your issue lies with either webpack-dev-middleware or webpack-hot-client. You'll have to figure out which.

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