-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
emitted data:text/javascript,__webpack_public_path__ = htmlWebpackPluginPublicPath; #1589
Comments
This is a bug we should fix on html-webpack-plugin site. Is the bug fixed if you remove your optimization section? |
Unfortunately I can't reproduce this issue - can you please help me so I can try to fix this issue? |
OKοΌI will make a repo reproduce this tomorrow |
The git repository is here: html-webpack-plugin-next-demo, just If I remove the last rule configuration, the build will be as expected:
maybe |
Oh you are right! :) Nice job - yes this rule says export all files which are NOT '.png' or '.html' files.. that is creating this strange behaviour |
Is it possible to fix it in html-webpack-plugin? |
I have one idea - I'll try and let you know :) |
Unfortunately it is cached up by your fallback loader no matter what I try to do.. However you can change your regexp slightly to ignore it: {
exclude: [/(^|\.(svg|js|jsx|ts|tsx|html))$/],
type: 'asset/resource',
} |
Same bug with: const Path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
module.exports = {
entry: Path.resolve(__dirname, 'src/index.tsx'),
output: {
path: Path.resolve(__dirname, (process.env.OUT_PATH || 'out/debug')),
filename: 'index.js'
},
module: {
rules: [{
test: /\.tsx?$/i,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
configFile : Path.resolve(__dirname, 'tsconfig.json')
}
}]
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
plugins: [new TsconfigPathsPlugin({
configFile: Path.resolve(__dirname, 'tsconfig.json')
})]
},
plugins: [
new HtmlWebpackPlugin({
title: 'Hot Module Replacement',
template: Path.resolve(__dirname, 'src/index.html')
})
]
} |
Yes, I'm getting the same error message but the above solution doesn't work for me, as I'm not actually using any sort of catchall webpack rule (or processing HTML files at all with my rules) so not really sure where this mangling is happening that must be short-circuiting I am also trying to use a EDIT: the problem was using an old Webpack. Was on |
Same problem with strange file
and content |
Same problem with strange file versions: filename: content: webpack config: and when remove file-loader its ok
|
@jantimon wanted to ask for clarification here: I also came to a conclusion that something is pushing an asset with an empty filename and that regex makes it skip that empty asset. I found it by using a function as an What was your idea behind this? What can be the possible reason this is happening? Cheers! |
The html-webpack-plugin 5.x adds an inline javascript to add support for the new It's an entry chunk added directly to the child compiler here: html-webpack-plugin/lib/child-compiler.js Line 119 in 0a6568d
Inline javascript assets won't have a name so the following regexp allows you to ignore it: {
exclude: [
/^$/,
],
} |
Current behaviour π£
after using webpack 5 build, seen that a file named
01b0bacef142817ca1a5
emitted in dist, which content is:Expected behaviour βοΈ
I'm not sure if this is the correct behavior and what this file does.
can i ignore this file by plugin like ignore-emit-webpack-plugin ?
Reproduction Example πΎ
my webpack.config.js as below:
Environment π₯
The text was updated successfully, but these errors were encountered: