Skip to content
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

fix(v2): fix plugin-ideal-image breaking website (exports not defined) #2074

Merged
merged 4 commits into from
Dec 1, 2019

Conversation

endiliey
Copy link
Contributor

@endiliey endiliey commented Dec 1, 2019

Motivation

First of all, #2011 broke the website

image

The netlify preview of that PR is also broken.
image

Why is this happening ?
We're using a bundler like Webpack that squeezes those modules into a single minimized javascript file, so you want to keep that line as-is.

When Typescript compiles into javascript, it adds the line Object.defineProperty(exports, "__esModule", { value: true }); which causes an error Uncaught ReferenceError: exports is not defined or something similar in your browser's console.

And we're doing the TS compilation wrong !
The current Typescript compiler setting of that pr also assumes you are writing a Node.js application, which is wrong. You should use the right tscompiler setting for DOM. But its slightly complicated because src/index.js is Node.js and src/theme/IdealImage.tsx is reactjs (not nodejs).

Anyway, I'm gonna revert the theme component conversion back to JS and just copy it as it is. The types isn't exactly accurate anyway.

This is an urgent fix because v2 site is broken now. No SPA load

I've deprecated the package in npm

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

  • Local build, no more export undefined

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Dec 1, 2019
@endiliey endiliey added the pr: bug fix This PR fixes a bug in a past release. label Dec 1, 2019
@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit 005c684

https://deploy-preview-2074--docusaurus-2.netlify.com

@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit 87ca193

https://deploy-preview-2074--docusaurus-2.netlify.com

@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Dec 1, 2019

Deploy preview for docusaurus-preview ready!

Built with commit 8bb1032

https://deploy-preview-2074--docusaurus-preview.netlify.com

@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit cbcd916

https://deploy-preview-2074--docusaurus-2.netlify.com

@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit 8bb1032

https://deploy-preview-2074--docusaurus-2.netlify.com

@endiliey endiliey merged commit 8a94810 into master Dec 1, 2019
@endiliey endiliey deleted the endi/fixidealimage branch December 1, 2019 14:59
@gimdongwoo
Copy link
Contributor

Thank you, @endiliey !
I want this problem to solve with typescript soon.

@endiliey
Copy link
Contributor Author

endiliey commented Dec 1, 2019

Sure @gimdongwoo feel free to send PR again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants