[BUG] with-web-accessible-resources
What happened?
Version
Latest
What OS are you seeing the problem on?
MacOSX
What browsers are you seeing the problem on?
No response
Relevant log output
No response
(OPTIONAL) Contact Details
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
- [X] I checked the current issues for duplicate problems.
import test from "./resources/test.json"
Yup, this will be fixed once https://github.com/parcel-bundler/parcel/pull/8269 is merged
Just BTW, you can also import the raw JSON like you have already done (i.e. it will be loaded as a JavaScript object).
import test from './resources/test.json';
console.log(test); // { "your": { "json": "here" } }
Alternatively you can import it as a link without even adding it to web_accessible_resources: Parcel will add it for you under the hood.
import testURL from 'url:./resources/test.json';
console.log(testURL); // chrome-extension://very_long_id/test.[hash].json
fetch(testURL).then(res => res.json()).then(console.log); // { "your": { "json": "here" } }
Just BTW, you can also import the raw JSON like you have already done (i.e. it will be loaded as a JavaScript object).
import test from './resources/test.json'; console.log(test); // { "your": { "json": "here" } }Alternatively you can import it as a link without even adding it to
web_accessible_resources: Parcel will add it for you under the hood.import testURL from 'url:./resources/test.json'; console.log(testURL); // chrome-extension://very_long_id/test.[hash].json fetch(testURL).then(res => res.json()).then(console.log); // { "your": { "json": "here" } }
Note: this is a good substitute for static importing. However, when an extension wants to provide a webpage with extra resource file to fetch (via the chrome:// protocol), it will not be a valid substitution.