Questions tagged [es6-modules]

The standard module system for JavaScript, introduced in ECMAScript 6 (2015).

1761 questions
0
votes
1 answer

webpack: comma in string causes syntax error during bundle

i am trying to bundle this file into my main js. var constants = { height: 600, width: 400, default_bezier = "[ { \"startPoint\" : [51.6503017608354,203.464445873753], \"endPoint\" : [-52.41285540263849,202.37245643258615],…
Tintinabulator Zea
  • 2,119
  • 3
  • 15
  • 24
0
votes
1 answer

Stop TS including import of definition file in output

I have a 3rd party library that is loaded dynamically with an authentication key. It's quite a complicated API, so I want type definitions in my TypeScript code. In my .tsconfig I'm using "target": "esnext" and "module": "esnext". With a type…
Keith
  • 133,927
  • 68
  • 273
  • 391
0
votes
1 answer

Webpack 4 SplitChunksPlugin - Common dependencies in Dynamic Imports

I'm using Dynamic imports with Webpack, as per the documentation: https://webpack.js.org/guides/code-splitting/#dynamic-imports Very basic example (not actual code): // main.js import('./moduleA).then((moduleA) => { …
0
votes
1 answer

ES6 Mapping and reducing frequency count

I have a csv file that contains data in the following format (although way more data). ID COL1 COL2 COL3 COL4 ----------------------------------------------------------- 1 opt1 opt1 opt1 …
katie hudson
  • 2,525
  • 10
  • 31
  • 71
0
votes
3 answers

How to split correctly my index.js into server.js and app.js?

I have the current index.js file which is running fine... but for use in my testing strategy, I want to split it into 2 files: server.js and app.js I am getting an error stating that my app.js is not a function.. what's wrong with my coding…
user762579
0
votes
1 answer

javascript modules export updated variable

I'm new to js modules and I don't fully understand how they works, my problem is; I have this fixed var that I need in more modules so at the moment my code is: let fixed const getFixed = () => { return $.getJSON('data/fixed.json') …
Sebastiano
  • 412
  • 3
  • 22
0
votes
0 answers

module export - Getting property 'default' of undefined in React Native

Facing problem with importing and exporting files. This was working with react-native 0.51.0 But not in react-native: 0.56 "babel-eslint": "7.2.3", "babel-plugin-transform-remove-console": "6.9.0", "babel-preset-react-native": "^5", Is it a…
Balasubramanian
  • 4,342
  • 3
  • 28
  • 51
0
votes
1 answer

How to resolve the ESLint error "Prefer default export ..."?

I have the following module, in which there is a named function... eslint ( airbnb ) is raising an error: 8:1 error Prefer default export import/prefer-default-export How should I restructure my code to comply to this requirement? exports /…
user762579
0
votes
0 answers
0
votes
1 answer

ES6 jsdom cannot read property 'innerHTML' of null

I'm trying to setup unit testing with Mocha while using jsDOM to simulate the virtualDom for my ES6; but I keep getting errors with the recent UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'innerHTML' of null Here's my main.js…
ChidinmaKO
  • 1
  • 1
  • 2
0
votes
0 answers

exporting as ES6 module

I recently started to updgrade my repository to babel 7 & webpack 4 and i'm getting the following error on a function of mine: SyntaxError: Unexpected token export at new Script (vm.js:79:7) at createScript (vm.js:251:10) at Object.runInThisContext…
Joelgullander
  • 1,376
  • 1
  • 13
  • 30
0
votes
1 answer

Uncaught SyntaxError: Unexpected token export - How to set up library

I'm building a crypto library for my app (the app runs on react using electron). The problem I have is that when I import the library in the react electron app I get the error "Unexpected token export". I tried different babel configurations on the…
0
votes
1 answer

view es6 module export/import dependencies

I have a web project with over 60 es6 modules that use export and import. I am looking for a way to graph, or map out, the relationships between the modules. I am looking for circular dependencies and opportunities for code splitting and just…
Richard Greenwood
  • 476
  • 1
  • 5
  • 15
0
votes
0 answers

How can I make an ES6 named export for parts of an object without exporting the whole object?

Here's a JavaScript object I'm working with: const tree = { birdhouse: { inspectNest: () => 'eggs' }, ... } I want the world to have access to the inspectNest function tucked into the middle there, but for hand-wavy reasons I do not want…
0
votes
2 answers

How do I add Skeleton.css to my React app?

I mainly use React in React Native and now I am building a website, so I am having a little trouble implementing skeleton.css in my React App.
1 2 3
99
100