Exposing Modules Imported from Nested Path
nathanforce opened this issue · 2 comments
Has there been any thought around exposing modules that are imported via a direct path, for example Lodash?
import map from lodash/map
I'm not sure of the best way to do it, or if it is even possible, but it would be a nice addition if so.
The only thing I could come up with is that you could have something ugly like..
global['Lodash'] = {
// ... main lodash export
}
// and then we'd add
global['Lodash']['/map'] = <map function>
Something along those lines. It's definitely not great but I'm curious to hear your thoughts.
Close in favor #79
sorry but #79 does not seem related.
I am encountering the same problem: trying to expose a package that is consumed as is, and also as nested files.
In my example, grapql
is consumed as:
import graphql from 'graphql';
import { ExecutionResult } from 'graphql/execution/execute';
import { DocumentNode } from 'graphql/language/ast';
import { parse } from 'graphql/language';
this makes my current loader irrelevant:
test: require.resolve('graphql');
loader: 'expose-loader',
options: {
exposes: "graphql"
}
this will expose window.graphql
correctly, but completely ignore internal files like graphql/language.
I wanted something like this:
{
descriptionData: { name: 'graphql' },
loader: 'expose-loader',
options: {
exposes: ['graphql', '__$internalFilepath']; // but this syntax does not exist
}
},
@alexander-akait - any thoughts?