1

How can I import all files in a folder using ES6 modules tools?

need something like:

files.forEach(function (file){
  import * as object from 'file';
}};
Sarkis Arutiunian
  • 1,135
  • 13
  • 30
  • 2
    What is it you're actually trying to do with these imported files? The short answer is "that won't work" with ES6 module syntax but it's hard to give more meaningful feedback with no other info to go on. – loganfsmyth Mar 23 '16 at 06:25
  • If you want to migrate current project with many modules, amd you lookin for fast&dirty solution, try use require(): /** * Requires all directives from subdirectories. */ function requireAll(requireContext) { return requireContext.keys().map(requireContext); } requireAll(require.context("", true, /^\.\/.*\.js$/)); http://stackoverflow.com/questions/35343362/integrate-ecmascript-6-into-existing-angularjs-project – DanDuh Mar 23 '16 at 10:04
  • I'm just trying create one npm package, which will manipulate users modules. I can know the folder were will be all the modules, but i can't now files and variables names. – Sarkis Arutiunian Mar 23 '16 at 15:22

0 Answers0