Closed letmaik closed 8 years ago
Correct, it won't work as-is. You're trying to transform the contents of your node_modules
directory which means you need to run browserify-shim as a global transform.
browserify -g browserify-shim entry.js
I tried this in various ways but it still doesn't change anything. I tried the following paths:
"./node_modules/covutils/lib/constants.js": "global:CovUtils.constants"
"node_modules/covutils/lib/constants.js": "global:CovUtils.constants"
"covutils/lib/constants.js": "global:CovUtils.constants"
Replaced my original comment when I realized what you were trying to do
I noticed that and had used your new comment as a base already, running it as a global transform with -g browserify-shim
. Any idea?
If you send me a working project I can step through in a debugger and see if it's reasonable to make this work or not.
Sure, just clone https://github.com/Reading-eScience-Centre/covjson-reader and do an npm install && npm run build
. In the generated covjson-reader.src.js
file I would expect to find CovUtils.constants
somewhere since src/constants.js
imports 'covutils/lib/constants.js'
. You can find the transpiled code under the lib/ folder which is then used for browserify.
Global functionality is provided by https://github.com/thlorenz/exposify. It doesn't support path resolution and I'd rather not add it since it massively increases the project's complexity.
Ok thanks for looking at it. This feature is supported by the JSPM bundler, maybe I can create my bundles with that, although I've never done that for pure npm packages (vs jspm packages).
I'm trying to do something like:
I'm require'ing certain modules of a package and those modules are exposed in the corresponding browser bundle within a global object. The above however doesn't work with browserify-shim. I don't see "CovUtils.constants" anywhere in the output file. Is this not supported?