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

feat: support import.meta.* for webpack #1298

Merged
merged 4 commits into from
Aug 27, 2024

Conversation

wattanx
Copy link
Collaborator

@wattanx wattanx commented Aug 25, 2024

πŸ”— Linked issue

Fixes: #1295

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR supports import.meta.* in webpack mode.
webpack 4 does not support import.meta, so we need to create a plugin.

I'm not sure whether to opt-in.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@wattanx wattanx marked this pull request as ready for review August 25, 2024 12:19
@wattanx wattanx force-pushed the feat/support-webpack-import-meta branch from 6bf210c to a1d7051 Compare August 26, 2024 13:41
@wattanx wattanx requested a review from danielroe August 26, 2024 14:24
const { pathname } = parseURL(
decodeURIComponent(pathToFileURL(id).href)
)
if (pathname.endsWith('.js') || pathname.endsWith('.vue')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we also need to handle .ts/.js/.tsx/.mjs files?

@wattanx
Copy link
Collaborator Author

wattanx commented Aug 27, 2024

In vite mode there may be cases where import.meta.* cannot be used.
https://github.com/nuxt/bridge/actions/runs/10561840303/job/29258454861?pr=1298
e4b1a63

This will be investigated later.

@danielroe danielroe merged commit 5493b4e into main Aug 27, 2024
61 checks passed
@danielroe danielroe deleted the feat/support-webpack-import-meta branch August 27, 2024 07:06
@github-actions github-actions bot mentioned this pull request Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Module parse failed: Unexpected token: import.meta
2 participants