Questions tagged [es6-module-loader]

ES6 Module Loader Polyfill dynamically loads ES6 modules in browsers and NodeJS with support for loading existing and custom module formats through loader hooks.

Dynamically loads ES6 modules in browsers and NodeJS with support for loading existing and custom module formats through loader hooks.

This project implements dynamic module loading through System exactly to the previous ES6-specified loader API at 2014-08-24 ES6 Specification Draft Rev 27, Section 15. The specification for the module loader was removed from the ES6/ES2015 specification in 2014, and a new loader implementing the new draft WhatWG loader spec is pending alpha release on the 1.0 branch.

For an overview of build workflows, see the production guide.

For an example of a universal module loader based on this polyfill for loading AMD, CommonJS and globals, see SystemJS.

Documentation

294 questions
8
votes
2 answers

Re-Exporting entire module in ES6/Babel

Let's say I have a module I want to re-export: //exportme.js export default 'EXPORTME'; export const test = () => console.log('test function'); //reexport.js export * from './exportme.js' When I import reexport.js, the default from exportme.js is…
wlingke
  • 4,699
  • 4
  • 36
  • 52
8
votes
2 answers

How to import a module in es6 that itself needs to invoke/initialize its function/class before being imported

I was wondering what is the best practice to import a module's function/class in another module that the module itself needs to invoke/initialize its own function/class before being imported into another module? I don't know if I could ask my…
Ali
  • 1,268
  • 1
  • 13
  • 20
8
votes
2 answers

es6 import as a read only view understanding

There is no detalied explanation of what exactly es6 import and export do under the hood. Someone describe import as an read only view. Check the code below: // lib/counter.js export let counter = 1; export function increment() { …
Jinxin Ni
  • 331
  • 3
  • 10
8
votes
1 answer

How to dynamically load modules in Babel and Webpack?

I'm trying to use the dynamic module loading feature in ES6 and it seems that it's not actually implemented yet. But there are substitutes like ES6 Module Loader Polyfill which supposedly should do the trick for the time being. So I have a ES6…
Mehran
  • 15,593
  • 27
  • 122
  • 221
8
votes
2 answers

Proper way to implement jwplayer in react component using webpack (react-starter-kit)

i am making VideoPlayer react component with jwpalyer and i am using webpack es6 for loading module webpack support npm module loading & there is no npm for jwplayer so am trying to include jwplayer.js using es6 import but it giving me error…
Anil Gupta
  • 2,329
  • 4
  • 24
  • 30
8
votes
1 answer

ES6 Bare Import: How to use, and when?

ES6 allows us to use a new import syntax. Using it, we can import modules into our code, or parts of those modules. Examples of usage include: // Import the default export from a module. import React from 'react'; // Import named exports from a…
user677526
7
votes
4 answers

Getting error TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for D:\Projects\matri-site\bin\www for Node Js v14

I am new to Node js and got some issues. Previously I was using node Js v13.8 to run my express application and it was working very well. I was using es6 syntax and type module having JS extension files. But, when I upgraded to Node 14.1.0. It's…
Raunak
  • 93
  • 1
  • 1
  • 6
7
votes
3 answers

Using webpack without transforming es6 to es5 code

I have a project that is just a few months old, and I decided to write it in ES6 to learn the new system. (Which I like a lot). The project is a sophisticated WebGL renderer. Initially I simply used es6 in the browser, (not using the modules…
Philip Taylor
  • 521
  • 5
  • 11
7
votes
2 answers

es6 modules native support

I understand the ES6 modules specification, the question is about its support. AFAIK, there are no browsers that implement this natively (see Browser compatibility here). Got a couple of questions about this: ES6 modules is an ES6 feature,…
ducin
  • 25,621
  • 41
  • 157
  • 256
7
votes
2 answers

ES6 default and named exports

I am trying to understand named and default exports. I have a seemingly basic requirement which I don't understand how to setup. I want to be able to import both: //app.js import Mod from './my-module' import { funcA, funcB } from…
mraxus
  • 1,377
  • 1
  • 15
  • 23
7
votes
1 answer

What is the difference between qualified and unqualified imports in the new javascript ES6 module lingo?

I came across this distinction which wasn't explained well in ExploringJS Qualified and unqualified imports work the same way (they are both indirections) What is the distinction and therefore what does this statement mean?
Arijit Bhattacharya
  • 1,265
  • 12
  • 12
7
votes
3 answers

Inject dependencies into ES2015 module

Is it possible to inject dependencies into ES2015 modules like in other programming languages like C# or Java? If I import a module I create a hard dependency to it and can not change it later at runtime. For example I have following JavaScript…
6
votes
1 answer

Can't import "mysql2/promise" into ES module (MJS) on Node.js 13 / 14

While migrating from CommonJS (.cjs) to ES Modules (.mjs), I've faced an issue of importing namespaced CJS to MJS: import mysqlPromise from "mysql2/promise"; returns an error: Error [ERR_MODULE_NOT_FOUND]: Cannot find…
Mike
  • 14,010
  • 29
  • 101
  • 161
6
votes
2 answers

ReferenceError: Unknown plugin "react-html-attrs" specified

I have tried all the way to run sample Module-Loader program based on YouTube but even after following with all the links in stackoverflow regarding this, am unable to fix the issue.Please find the details of my project below, My Project…
sunleo
  • 10,589
  • 35
  • 116
  • 196
6
votes
3 answers

Globally-available mixin in VueJS

I'm trying to create a mixin that's globally available, but not automatically injected into every component. i.e. i do NOT want this: Vue.mixin({...}); I set up the project according to these instructions. This is my project structure. I also have…
ierdna
  • 5,753
  • 7
  • 50
  • 84