es6-modules Questions
2
I feel this is a question that should be answered but cannot find an answer.
I've switched my TS project to ESM. So my package.json now has "type": "module" and my tsconfig.json...
Guernsey asked 15/10, 2022 at 22:30
3
I have an working nextjs project.
I need to create a script that I can run from the CLI that uses some of the CRUD libraries I've written for the next project.
**/scripts/backup-assets.js **
import...
Rockbound asked 11/5, 2022 at 6:30
1
Barrel/index files seem to create issues when used with next.js. It doesn't seem established if it's purely a webpack issue or both webpack and next.js
According to this issue tree shaking stops wo...
Roulette asked 5/7, 2021 at 16:21
2
Solved
I have a Node API set up with TypeScript working fine.
However, to import an ES6 extension, I have to include .js even though the file is .ts.
Using the .ts extension or leaving out the extension i...
Dordrecht asked 22/8, 2022 at 18:35
2
I've setup differential loading to serve ES6 modules to newer browsers. I've run into a problem where modules are deferred by default with the script tag even without the defer attribute. I.e.
<...
Workingwoman asked 30/6, 2019 at 8:18
3
I have recently started learning Webpack. What I have understood is that it bundles various assets like JavaScript, CSS, etc., into bundles.
But regarding JavaScript, can't we achieve the same fun...
Soemba asked 11/8, 2019 at 8:50
6
Solved
I'm trying to use lodash in my web application. I have installed lodash using npm in my local project.
I plan on using the ES6 modules in my code.
Here is my main.js file:
import * as _ from "l...
Reba asked 28/9, 2018 at 15:47
2
In Chrome extension, I have a javascript function that I need to reuse both from content script and from background worker JS files.
How can I organize scripts for that?
So far I only managed to d...
Expansive asked 19/8, 2022 at 20:0
1
Solved
I'm currently rewriting a NodeJS project from a messy combination of CommonJS and Babel-transpiled ES Modules to be completely ES Module based.
In the process, I've become a bit confused by how Nod...
Typescript asked 14/10, 2022 at 12:21
6
Solved
Hi I am doing some research on RxJS. I am able to use the library simply by referencing it in my browser as such:
<script src="https://unpkg.com/@reactivex/[email protected]/dist/global/Rx...
Te asked 22/7, 2018 at 3:12
3
I see some questions of this kind, but none of them really gets my problem.
I'm developing a webapp using next.js (working with typescript). In my app uses recharts, but the compilation fails with ...
Corgi asked 31/7, 2022 at 5:18
1
I get this error:
C:\Users\myname\Projects\ConfigEditor\MesConfiguration.WebClient\node_modules\tslib\tslib.es6.js:24
export function __extends(d, b) {
^^^^^^
SyntaxError: Unexpected token 'exp...
Driblet asked 21/3, 2022 at 16:14
2
Solved
I want to import from another script tag.
<script type="module">
export default "str"
</script>
<script type="module">
import foo from "????&...
Upstretched asked 4/12, 2020 at 4:42
3
Solved
I'm trying to setup a very simple NPM codebase that I can use to drive an API to do some testing.
The line of code causing the error is just import fetch from "node-fetch";, see the code....
Wachtel asked 16/6, 2022 at 6:59
11
From https://2ality.com/2019/04/nodejs-esm-impl.html Node 12 should support es6 modules; however, I just keep getting the error:
Question: How do I make a MVP of using es6 modules in node 12?
pac...
Engaging asked 23/7, 2019 at 17:58
9
Is it possible to pass options to ES6 imports?
How do you translate this:
var x = require('module')(someoptions);
to ES6?
Ingoing asked 28/4, 2015 at 15:42
1
I followed this tutorial to create a dual package. This is what the package file structure looks like:
my-awesome-lib
package.json
dist
|-- mjs
|-- package.json
|-- index.js
|-- cjs
|-- pack...
Groundwork asked 3/1, 2022 at 1:15
2
Solved
I have multiple files called PageX, PageY, PageZ etc.
Each of these have an export default SETUP { path:'blah_X', component:X }.
In my index.js I want to import these SETUPs into an array like th...
Bal asked 4/3, 2017 at 11:9
2
Now I'm trying to import aws-exports.js which amplify-js automatically generates in node es6 type code.
my code like this. ex:something.mjs
#!/usr/bin/env node
import awsmobile from '../src/aws-ex...
Selfinduced asked 4/2, 2021 at 13:22
3
Solved
I was under the impression that this syntax:
import Router from 'react-router';
var {Link} = Router;
has the same final result as this:
import {Link} from 'react-router';
Can someone explain ...
Debra asked 4/11, 2015 at 14:43
5
Solved
With Rollup I can output an ES module by simply setting the format option to 'es'. How can I do the same with webpack? If it's not possible now, does webpack have any plans to add it?
The only thi...
Residence asked 22/12, 2016 at 17:57
2
This question is not specific to Jest as it applies to all testing libraries with stubbing capabilities.
ESM modules have immutable named and default exports, which means this is no longer valid:
/...
Barrier asked 16/8, 2022 at 19:14
1
Solved
Have a TS 4.7 library using ESM modules.
tsconfig.json:
"target": "ES2020",
"module": "ES2020",
"lib": ["ES2020"],
"moduleResol...
Sew asked 21/8, 2022 at 21:43
12
Solved
Is it possible to import something into a module providing a variable name while using ES6 import?
I.e. I want to import some module at a runtime depending on values provided in a config:
import so...
Heard asked 20/3, 2015 at 14:6
2
Have got a successful jest/esm setup, however occasionally a module is released that specifies both a main key (for commonjs) and a module key (for ESM) in its package.json. This leads to jest erro...
Abcoulomb asked 8/5, 2022 at 17:32
© 2022 - 2024 — McMap. All rights reserved.