publicPath not doing anything
See original GitHub issueThis might be related to #222.
- Operating System: Windows 10
- Node Version: v10.12.0
- NPM Version: v6.9.0
- webpack Version: v4.32.2
- mini-css-extract-plugin Version: v0.6.0
Expected Behavior
publicPath
should overwrite the output directory specified in output.path
Actual Behavior
Using publicPath
doesn’t seem to do anything. If it’s defined as a function it does get called, but the return value is never used.
Code
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.s?css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: 'any/path/absolute/or/relative'
}
},
'css-loader'
]
}
]
}
How Do We Reproduce?
By using the configuration above.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:17 (3 by maintainers)
Top Results From Across the Web
MiniCssExtractPlugin public path not working - Stack Overflow
I have given publicPath option for MiniCssExtractPlugin but it is not taking this option value, it is taking output.publicPath option.
Read more >Webpack — Understanding the 'publicPath' mystery - Medium
Webpack has been initialised using a configuration object that does not match the API schema. - configuration.output.path: The provided value ".
Read more >Public Path - webpack
The publicPath configuration option can be quite useful in a variety of scenarios. It allows you to specify the base path for all...
Read more >Change publicPath - Released - Frontity Community Forum
so that I am not restricted to the /static folder. As a Frontity developer ... When you had it working as a query...
Read more >Public Path Problem | ilc-sdk - GitHub Pages
However, all those approaches does not support SSR. All of them use URL of the currently executed JS file in order to try...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Please create minimum reproducible test repo
Despite I landed here for the same reason described by @HoldYourWaffle, now that I’ve better read the docs of both
MiniCssExtractPlugin
andwebpack.output
I think that there’s a misunderstanding about the expected behavior of the plugin’spublicPath
option.What we’re currently expecting from the
publicPath
option is what in the case ofwebpack.output
is done bypath
. Butwebpack.output
allows forpublicPath
too. According to the docs the former is the output directory as an absolute path, while the latter specifies the public URL of the output directory when referenced in a browser.In a few words what we wanted here is
path
, notpublicPath
. And thepath
behavior can be achieved through the pluginfilename
option, as already said in some comments above.