Skip to content

API - Using Preloaded Assets with the Compiler #141

Closed
@pksjce

Description

@pksjce

From @danschumann on March 11, 2015 14:0

I have all my files in memory, for various reasons I won't get into ( maybe one is because I wrote a loading module loaddir and tend to use it ), but part of it is re-using code on the front end and back end.

My loaded files look like this (asObject: true):

require('loaddir')({path: './scripts', asObject: true }).then(function(directory) {
  /* directory == {
     'file1': 'console.log("file1");',
     'subDirectory': {
         'file2': 'console.log("subDir/file2");',
     },
  } */
});

or, my loaded files look like this (asObject: false)

require('loaddir')({path: './scripts' }).then(function(directory) {
  /* directory == {
    'file1': 'console.log("file1");',
    'subDirectory/file2': 'console.log("subDir/file2");',
  } */
});

How do I give a manifest like this to webpack, telling it "Hey webpack, I already loaded everything, can you just compile using this data plz?"

Copied from original issue: webpack/webpack#874

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions