From 4c6e3a97bc9bcda54598945625e427cfe46f118a Mon Sep 17 00:00:00 2001 From: MaoShizhong <122839503+MaoShizhong@users.noreply.github.com> Date: Fri, 6 Sep 2024 23:32:19 +0100 Subject: [PATCH] Rephrase instructions Better served as main lesson text rather than a note box --- .../organizing_your_javascript_code/es6_modules.md | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/javascript/organizing_your_javascript_code/es6_modules.md b/javascript/organizing_your_javascript_code/es6_modules.md index 63ea2b0bf9e..b0ba63edd66 100644 --- a/javascript/organizing_your_javascript_code/es6_modules.md +++ b/javascript/organizing_your_javascript_code/es6_modules.md @@ -214,17 +214,7 @@ two.js <-------------- one.js <-------------- three.js Note that we only needed the one script tag, as the browser will handle the additional file dependencies for us. We also did not need to add the `defer` attribute, as `type="module"` will automatically defer script execution for us. -If you had coded along with the IIFE example at the start of the lesson, try rewriting the JavaScript to use `import` and `export`, and link only the entry point as a module script. - -
- -#### Opening ES6 modules locally in the browser - -Due to security restrictions with the `file://` protocol, if you try to open an HTML file with module scripts directly in the browser (e.g. running `google-chrome index.html` in the terminal or similar), you will be greeted with a CORS error. - -ES6 modules need to be served via a server. For now, if you haven't been using it already, you should use Visual Studio Code's [Live Server extension](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer). - -
+If you had coded along with the IIFE example at the start of the lesson, try rewriting the JavaScript to use `import` and `export`, and link only the entry point as a module script. Due to browser security reasons, ES6 modules cannot be loaded if you open the HTML file directly in the browser, so make sure you use Visual Studio Code's [Live Server extension](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) if you aren't already. ### CommonJS