-
-
Notifications
You must be signed in to change notification settings - Fork 375
Closed
Description
What is the current behaviour?
When I change output paths via preact.config.js file, generated push-manifest.json file is wrong.
Steps to reproduce:
- Change output paths via
preact.config.jsfile:
export default (config, env, helpers) => {
config.output.filename = "scripts/" + config.output.filename;
config.output.chunkFilename = "scripts/" + config.output.chunkFilename;
const { plugin: babelEsmPlugin } = helpers.getPluginsByName(config, "BabelEsmPlugin")[0];
babelEsmPlugin.options_.filename = "scripts/" + babelEsmPlugin.options_.filename;
babelEsmPlugin.options_.chunkFilename = "scripts/" + babelEsmPlugin.options_.chunkFilename;
const { plugin: miniCssExtractPlugin } = helpers.getPluginsByName(config, "MiniCssExtractPlugin")[0];
miniCssExtractPlugin.options.filename = "styles/" + miniCssExtractPlugin.options.filename;
miniCssExtractPlugin.options.chunkFilename = "styles/" + miniCssExtractPlugin.options.chunkFilename;
};- Build:
$ npm run build- Check generated
push-manifest.jsonfile:
$ cat build/push-manifest.json{"/":{"undefined":{"type":"script","weight":1}}}What is the expected behaviour?
Generate correct push-manifest.json file.
Please mention any other relevant information:
| for (let filename in assets) { |
In filename variable are not basenames of assets, but whole path, therefore regular expressions won't match.
scripts/bundle.945f9.js
scripts/bundle.d7579.esm.js
scripts/polyfills.60e68.js
scripts/polyfills.aae10.esm.js
styles/bundle.fa67f.css
sw-esm.js
sw.js
| } else if (/^bundle(.+)\.css$/.test(filename)) { |
| } else if (/^bundle(.+)\.js$/.test(filename)) { |
Please paste the results of npx preact-cli info here.
Environment Info:
System:
OS: Linux 4.15 Ubuntu 16.04.7 LTS (Xenial Xerus)
CPU: (4) x64 Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
Binaries:
Node: 17.6.0 - /usr/bin/node
Yarn: 1.22.5 - /usr/bin/yarn
npm: 8.5.1 - /usr/bin/npm
Browsers:
Chrome: 99.0.4844.51
Firefox: 88.0
npmPackages:
preact: ^10.3.1 => 10.6.6
preact-cli: ^3.0.0 => 3.3.5
preact-render-to-string: ^5.1.20 => 5.1.20
Metadata
Metadata
Assignees
Labels
No labels