Skip to content

Push manifest does not adhere custom changes in preact config file #1675

@oliverfindl

Description

@oliverfindl

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:

  1. Change output paths via preact.config.js file:
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;

};
  1. Build:
$ npm run build
  1. Check generated push-manifest.json file:
$ 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:

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions