webpack-contrib / file-loader

File Loader
MIT License
1.86k stars 255 forks source link

Path variables does not work inside publicPath #362

Closed ghost closed 4 years ago

ghost commented 4 years ago

Expected Behavior

publicPath: ('[ext]' === 'js' || '[ext]' === 'css') ? "{$basePath}/dist/" : "./", => [ext] will return file extenstion

Actual Behavior

publicPath: ('[ext]' === 'js' || '[ext]' === 'css') ? "{$basePath}/dist/" : "./", => [ext] will return string '[ext]'

Code

https://gist.github.com/acqsk/45014a9cfd592a2b5bd9fbbbc8d94af3

How Do We Reproduce?

npm run build

alexander-akait commented 4 years ago

Because publicPath doesn't support patterns please read https://webpack.js.org/configuration/output/#outputpublicpath and https://webpack.js.org/guides/public-path/

ghost commented 4 years ago

@evilebottnawi but till now, It was working. Something was changed?

alexander-akait commented 4 years ago

output.publicPath is option for webpack, not for file-loader

ghost commented 4 years ago

output.publicPath is option for webpack, not for file-loader

@evilebottnawi thanks for info, but till upgrade packages, the [ext] inside publicPath was working. How can I make the same without [ext]? I need to modify the path of files, which I will inject into html (with HtmlWebpackPlugin).