Comments (6)
Yeah that's how it was, I couldn't get it to work at all unfortunately.
from parcel-namer-rewrite.
Ok, there is the branch for this issue
https://github.com/ol-loginov/parcel-namer-rewrite-issues/tree/12
There are 2 issues:
- Plugin uses file name returned by default namer. And as long as your "myscript.js" is not entry point - it's named by entry bundle. That's why it get name "404.js" (because bundle is constructed from 404.html) and ignored by rewrite rules.
- And if you add this file as entry (see package.json/targets/default/source) - you won't get the desired result, because the first rule match will be used: "(.*).js". To match "myscript.js", one should move this rule to first position in packages.json
After both of this points has been taken into account - you'll got what you need. You may find the example in that branch.
from parcel-namer-rewrite.
Nothing has changed. It should inside root element, like this:
{
// ...
"parcel-namer-rewrite": {
"chain": "@parcel/namer-default",
"rules": {
"(.*).css": "assets-rewrite/css/$1{.hash}.css",
"(.*).js": "assets-rewrite/js/$1{.hash}.js",
"(.*).(jpg|png|gif|svg|webp|avif)": "assets/img1/$1.$2"
}
},
// ....
}
from parcel-namer-rewrite.
I checked from your repo, not work
Added myscript.js to 404.html, and after build myrewrite/js/myscript.js does not exist
Screen
https://share.cleanshot.com/VxNmt0
from parcel-namer-rewrite.
It seems to work as it should, but the file is empty inside =/
Работает как надо вроде бы, но файл пустой внутри =/
from parcel-namer-rewrite.
This is because of optimization. Unused function test
has been thrown away.
You should "exports" stuff that you need outside the file. For example, call a function, use exports
or assign attribute to global
(like in "standalone.js" in repo)
I've changed the branch to simplify example.
from parcel-namer-rewrite.
Related Issues (13)
- The "from" argument must be of type string. Received undefined HOT 2
- multiple entry build error HOT 1
- Allow removing file name hashes HOT 2
- How to remove hash HOT 4
- PARCEL-NAMER-REWRITE-PROFILE leads to error HOT 1
- Rules: Allow referencing source directories as "from" part
- [Suggestion] Join forces with 'structurize' and 'custom-dist-structure' HOT 3
- Following setup instructions in docs, Parcel cannot find 'default' namer HOT 2
- Add some examples to the readme HOT 5
- useParcelHash config HOT 2
- Ability to disable the plugin in development mode HOT 2
- Allow relative paths HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parcel-namer-rewrite.