-
Notifications
You must be signed in to change notification settings - Fork 37
Use webpack native json behavior for loading json files via assetUrl #745
Conversation
Unless I'm mistaken, I think we should be able to remove Since this is a breaking change, we should figure out how we will want to ship this (potentially codemods?) and if there's any other breaking changes we want to make in v2 before releasing this. |
@rtsao I thought so too, but removing it entirely doesn't seem to work with json files that were added to the build via assetUrl |
Ah, I see, it must be taking precedence over file-loader? |
The comment in the json-loader also mentioned this would be a breaking change, but I haven't been able to identify how this breaks for a consumer. The only effect should be that unused keys should be removed from the client-main build. Am I missing something? |
After comparing webpack v3 and v4 behavior, I think you are right -- there is no breaking change. I recall looking into this earlier and there was some different behavior regarding default exports, but maybe I was mistaken or this has changed in the meantime. |
test/e2e/assets/test.js
Outdated
@@ -89,11 +89,25 @@ test('`fusion dev` works with assets', async () => { | |||
); | |||
t.equal(await request(`${url}/dirname`), 'src'); | |||
t.equal(await request(`${url}/filename`), 'src/main.js'); | |||
|
|||
const jsonAssetUrl = await request(`${url}/json`); | |||
const jsonAsset = (await request(url + jsonAssetUrl)).replace(/\s/g, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: maybe use JSON.parse
and t.deepEqual
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better. Thanks!
!merge |
Triggered Fusion.js build verification: https://buildkite.com/uberopensource/fusion-release-verification/builds/1770 |
No description provided.