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

handle bare imports in HTML <script> tags when running build command #434

Closed
1 of 5 tasks
thescientist13 opened this issue Nov 8, 2020 · 1 comment · Fixed by #472
Closed
1 of 5 tasks

handle bare imports in HTML <script> tags when running build command #434

thescientist13 opened this issue Nov 8, 2020 · 1 comment · Fixed by #472
Assignees
Labels
alpha.7 CLI enhancement Improve something existing (e.g. no docs, new APIs, etc) good first issue Good for newcomers v0.10.0

Comments

@thescientist13
Copy link
Member

thescientist13 commented Nov 8, 2020

Type of Change

  • New Feature Request
  • Documentation / Website
  • Improvement / Suggestion
  • Bug
  • Other (please clarify below)

Summary

Coming out of #417, need to handle this case

<script type="module">
  import '@evergreen-wc/eve-container';
</script>

or maybe even

<link href="/node_modules/prism/prism.css" rel="stylesheet"></link> 

Details

Otherwise getting this error in the console
Screen Shot 2020-11-08 at 12 34 30 PM

@thescientist13 thescientist13 added bug Something isn't working CLI labels Nov 8, 2020
@thescientist13 thescientist13 self-assigned this Nov 8, 2020
This was referenced Nov 8, 2020
@thescientist13 thescientist13 added enhancement Improve something existing (e.g. no docs, new APIs, etc) and removed bug Something isn't working labels Nov 16, 2020
@thescientist13 thescientist13 changed the title handle ESM imports in HTML <script> tags for production handle imports in HTML <script> / <style> / <link> tags for production Nov 16, 2020
@thescientist13
Copy link
Member Author

thescientist13 commented Dec 31, 2020

Actually, in regards to Polyfills plugin I realize that I may be conflating two things here.

There is a difference between having a file with some code (the issue in #450 )

<script src="bare-import.js">

vs just some code (the issue here)

<script>
  /* some code */
</script>

We can easily feed <script> tags to Rollup, but pure JS (or CSS or whatever) code inside a <script> tag would have to be processed with something like acorn I think, kind of like we do with building up an importMap.

However, this was not something webpack was doing for us, so I think we should make the smallest concession here to support the immediate issue by making sure bare paths to node_modules can be resolved when included via <script> / tags with a src / href and track adding support for additional cases post 1.0 as they come up.

@thescientist13 thescientist13 changed the title handle imports in HTML <script> / <style> / <link> tags for production handle bare imports in HTML <script> / <style> / <link> tags for production Jan 26, 2021
@thescientist13 thescientist13 changed the title handle bare imports in HTML <script> / <style> / <link> tags for production handle bare imports in HTML <script> tags when running build command Jan 26, 2021
@thescientist13 thescientist13 added the good first issue Good for newcomers label Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha.7 CLI enhancement Improve something existing (e.g. no docs, new APIs, etc) good first issue Good for newcomers v0.10.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant