-
Notifications
You must be signed in to change notification settings - Fork 922
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
Support comments in dynamic imports #535
Comments
I'd like to help on this one |
That would be great! I think the first step would be finding out where this is happening: I thought that it was us doing this but now I'm not so sure. We actually don't seem to touch dynamic imports unless they are ONLY a string via Does Babel do this by default? Or esbuild? |
ionic react use dynamic imports . import ReactDOM from "react-dom";
import React, { FC } from "react";
import {IonContent} from "@ionic/react";
const App: FC = () => {
return <div><IonContent>Hello world</IonContent></div>;
};
ReactDOM.render(<App />, document.body);
|
I was looking into this. No great progress, however, when I found the following thing with babel presets:
@FredKSchott If this clicks something in your head, I can create a PR. Its just that I am new to the codebase so not sure where we are wiring different babel presets. |
Also, there was a problem with rollup which they fixed quite early. Reference here: rollup/rollup#2778 |
Curious of @babel/preset-env is doing this if you're not touching dynamic imports. The repl seems to be rewriting |
Okay, dug into this a bit more and it's definitely coming from esbuild, and based on this convo I don't think the project is interested in adding comment preservation: evanw/esbuild#221 Some options to solve:
|
add this code to your "index.html", then the problem will be resoved: <script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core/dist/ionic/ionic.esm.js"></script>
<script nomodule src="https://cdn.jsdelivr.net/npm/@ionic/core/dist/ionic/ionic.js"></script> |
See: FredKSchott/create-snowpack-app#152
Webpack supports configuring code-split bundles via comment:
While we don't care too much about matching webpack support, it would be nice to preserve these comments for anyone connecting a webpack bundler to their final build. Right now, Snowpack's import resolver appears to strip comments and convert this sort of import directly to:
The text was updated successfully, but these errors were encountered: