mdn / mdn/fred

Provide a way to use module script in MDN Playground Javascript code

Open
#1,754 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
233
Forks
61
Avg merge
1d 1h
Merged PRs (30d)
82

Description

I'd like to use the import keyword in MDN Playground Javascript code but it currently fails with SyntaxError: Cannot use import statement outside a module.
Is there something hidden like js live-sample_example module I could use by any chance?

This is blocking me from updating MDN documentation page. Here's my workaround for now: https://github.com/mdn/content/pull/44981

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the MDN Playground JavaScript execution entry point and compare its current handling with the workaround in mdn/content#44981. Confirm how module scripts are represented, then verify that Playground code can use import without the current syntax error and that existing non-module examples still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.