-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
Change source files to build artefacts mapping #1677
Comments
Really the only rules are The
We need to pass the favicon path to The output favicon file (
That's just 2 of the 6 fallback values. You can specify titles for pages through your prerender data, or, if you just have the single page, you can write it in your template. Lot of flexibility there, and I'd argue you probably don't want to connect your HTML title to your manifest, in all honesty.
You're in control of the output, you have the entire Webpack config available to you. Some users disable hashed filenames, at which point Again, unlike CRA, you have the full freedom to edit as you see fit. Outputting everything to
That's a bit odd, as the exact same problems exist in CRA: blindly move files around and you won't get the desired output. At least here you can configure the build process as you'd like using your I don't know if we're interested in a |
@rschristian if those rules are documented (at least in this repo's README), I'd say the rules are excellent and totally workable. I like this rules more than the Do you plan to add this to the documentation? Ideally the Preact's website should also be updated to document this. I encountered the @mui/material example still using |
I have #1611 to track this, though my list of things to do is exceptionally long at the moment. It'd probably go into the wiki rather than the ReadMe, as that's already getting to the point where it's difficult to navigate around it.
We don't really document Maybe I could write up a new docs site like what we've done to document WMR, but that'd need an even greater time investment from me (or anyone else looking to do it).
I wouldn't really say that. We have a couple first-party (
Totally agree. Contributions always welcome of course. The copy patterns are here: preact-cli/packages/cli/lib/lib/webpack/webpack-client-config.js Lines 82 to 96 in fcd0375
|
What is the current behaviour?
Currently, source files map to build artefacts as following:
What is the motivation or use case for changing this behaviour?
'assets' was created by 'simple' template. OK.
Then I found I need 'static' for robots.txt. #436.
Then I found I need regexes for caching rules. #1364.
Now, when adding/looking for an asset I have to recollect the difference between 'assets' and 'static'. #1611
If I try to simplify and use 'static' instead of 'assets', favicon link is not added to the html.
If I put manifest.json to 'static', title is not expanded properly in the html.
Even if I fix favicon and title in the html manually, 'assets' is still required (with at least one file).
So, we need to use all 'assets' and 'static' and '/' and remember what goes where.
Describe the solution you'd like
Can these 6 rules be simplified to 2?
Please mention any other relevant information.
This is how create-react-app does it.
As a lot of devs come from there, it could be beneficial to match.
Above points are rather minor, and could possibly be resolved by re-configuration.
But absence of good defaults kills otherwise "streamlined" feeling.
Especially after using create-react-app where it all "just works".
Please paste the results of
npx preact-cli info
here.System:
OS: Windows 10 10.0.19043
CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Binaries:
Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.15 - C:\Program Files\nodejs\yarn.CMD
npm: 7.19.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 99.0.4844.51
Edge: Spartan (44.19041.1266.0), Chromium (99.0.1150.36)
npmPackages:
preact: ^10.1.0 => 10.6.6
preact-cli: ^3.0.0 => 3.3.5
preact-render-to-string: ^5.1.2 => 5.1.20
The text was updated successfully, but these errors were encountered: