-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Error with default export #17
Comments
Thanks for the report. It looks like this is because of the mismatch between how ES6 and CommonJS default exports work. This isn't surprising because I took some shortcuts with my implementation and haven't completely replicated what Babel does yet. Babel injects this code whenever you use an ES6 default import in case the imported file uses CommonJS instead of ES6: function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
} This transformation also requires all code using ES6 modules to assign something to |
I should mention that doing this instead should serve as a workaround until this is fixed: import * as PropTypes from 'prop-types'; |
This should be fixed, but you didn't leave reproduction steps so I can't confirm the fix myself. Can you let me know if the issue is fixed for you or not? |
This changes have broken another stuff. index.jsx:3:7: error: File extension not supported: PROJECT_ROOT/node_modules/antd/dist/antd.css
import 'antd/dist/antd.css';
~~~~~~~~~~~~~~~~~~~~
index.jsx:4:7: error: File extension not supported: PROJECT_ROOT/src/index.scss
import './index.scss';
~~~~~~~~~~~~~~
App.jsx:2:7: error: File extension not supported: PROJECT_ROOT/src/App.scss
import './App.scss';
pages/sign-in/SignInPage.jsx:4:19: error: File extension not supported: PROJECT_ROOT/pages/sign-in/SignInPage.module.scss
import styles from './SignInPage.module.scss';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ l'll try to make repo to reproduce all of this. |
This was a separate change I made, independent of the fix for this issue: bab150d. CSS and SCSS have never been supported. I was previously importing them as text files (so the default export for each file was a string) but they are now no longer allowed to be imported, since that's almost certainly not what you want. I was importing them as text files initially to make it easier for me to test some code bases that use CSS imports, since that at least gets them to build (although they will crash at run time). Now that people have noticed this project, I have removed this behavior so esbuild doesn't silently do the wrong thing. I plan to eventually implement a CSS parser and integrate real CSS bundling into esbuild. But it won't be possible to import CSS files until I implement that first. |
This is vital for web apps. When is CSS parser going to be implemented? I'm just wondering approximate date when i can be back to this project and try it again. |
I'm not sure, but I just filed #20 to track the CSS feature. You can subscribe to that issue to be updated when it's implemented. |
@evanw I can confirm that |
just bumping again to notify this still exists cause it's been 5 months now since the last one |
I can tell that "import * as multer from 'multer';" (TypeScript 4.1) |
It's not clear from your post what the code following the import statement is doing, but if you use import * as multer from 'multer'
multer() For historical reasons the official TypeScript compiler defaults to a loose compilation mode that deviates from the ECMAScript specification. It turns the above code into Modern TypeScript code should be using the import multer from 'multer'
multer() |
got following error
compilled code
original one
prop-types code
This is caused by UI library ant.d which i use for my project.
The text was updated successfully, but these errors were encountered: