We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
There seems to be an issue with injecting the assets into the html file. This is my config:
// @ts-check const path = require("path") const webpackMerge = require("webpack-merge") const HtmlPlugin = require("html-webpack-plugin") const CopyPlugin = require("copy-webpack-plugin") /** @type {import("webpack").Configuration} */ const baseConfig = { mode: "none", entry: ["regenerator-runtime/runtime", "./src/client.tsx"], target: "electron-renderer", plugins: [ new HtmlPlugin({ template: path.resolve(__dirname, "public/index.html"), filename: path.resolve(__dirname, "build/public/index.html"), inject: "body", }), ], module: { rules: [ { test: /\.[jt]sx?$/, use: { loader: "babel-loader", options: { presets: [ "@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript", ], plugins: [ ["@babel/plugin-proposal-decorators", { legacy: true }], ["@babel/plugin-proposal-class-properties", { loose: true }], ], }, }, }, ], }, resolve: { extensions: [".tsx", ".ts", ".js"], }, optimization: { splitChunks: { chunks: "all", }, }, output: { filename: "[name].js?q=[chunkhash]", chunkFilename: "[name].js?q=[chunkhash]", path: path.resolve(__dirname, "build/public"), publicPath: "/", }, } /** @type {import("webpack").Configuration} */ const devConfig = { mode: "development", devtool: "inline-source-map", devServer: { contentBase: path.join(__dirname, "build/public"), historyApiFallback: true, compress: true, port: 9000, }, } /** @type {import("webpack").Configuration} */ const prodConfig = { mode: "production", plugins: [ new CopyPlugin([ { from: "./public", ignore: ["./public/index.html"], }, ]), ], optimization: { minimize: true, nodeEnv: "production", }, } module.exports = (() => { if (process.env.NODE_ENV === "production") { console.info("Running production config") return webpackMerge(baseConfig, prodConfig) } console.info("Running development config") return webpackMerge(baseConfig, devConfig) })()
I'm using webpack 4.42.1. That config gives me this output with version 4.0.3 of html-webpack-plugin:
4.42.1
4.0.3
<!DOCTYPE html> <html> <head> <title>App</title> </head> <body> <div class="app"></div> </body> </html>
... Which is just my html template, unaltered. When I downgrade to 3.2.0 and use the same exact config, I get the correct output:
<!DOCTYPE html> <html> <head> <title>App</title> </head> <body> <div class="app"></div> <script type="text/javascript" src="/vendors~main.js?q=2c2be8eba775d5c91fff"></script><script type="text/javascript" src="/main.js?q=65d61f7fa05a8f00b200"></script></body> </html>
The text was updated successfully, but these errors were encountered:
This problem has been solved in 4.0.4 #1355
Sorry, something went wrong.
Oh! Pardon me.
No branches or pull requests
There seems to be an issue with injecting the assets into the html file. This is my config:
I'm using webpack
4.42.1
. That config gives me this output with version4.0.3
of html-webpack-plugin:... Which is just my html template, unaltered. When I downgrade to 3.2.0 and use the same exact config, I get the correct output:
The text was updated successfully, but these errors were encountered: