Comments (3)
Hi @acthp
I have never used webpack and don't know what may be causing the problem. Does webpack also use the package.json file to install dependencies?
from muts-needle-plot.
Yes, webpack uses npm and require(). The problem is that muts-needle-plot uses a combination of require() , and global variables, with d3, underscore, and d3-svg-legend being loaded as globals, but others being loaded with require(). I eventually worked out a solution using webpack's shims for legacy modules. Like this:
// The next three are required for muts-needle-plot.
{ test: /d3-svg-legend/, loader: "imports?d3=d3" },
{ test: /muts-needle-plot/, loader: "imports?_=underscore" },
// The d3-tip AMD loader does not populate d3.tip, which is expected
// by muts-needle-plot. So, we disable it here. The CommonJS loader
// will populate d3.tip.
{ test: /d3-tip/, loader: "imports?define=>false" },
and also doing an explicit require() for d3-svg-legend. The 'imports' loader injects a binding into a module that is expecting a global variable.
If you don't want to directly require() some dependencies, e.g. so the user can override them, you can parameterize the lib with the dependencies. Like change the globals to parameters on the constructor, or on an 'initialize' routine.
from muts-needle-plot.
Ok, thanks for the info and glad you could manage it, @acthp.
The above line you have added to the package.json
? Please feel free to make a fork and add you changes.
Also if you know very well which changes to make to muts-needle-plot I would appreciate a patch since in this moment I don't see time to tackle this issue and it wuold help you clean up the code in your project.
Best
from muts-needle-plot.
Related Issues (11)
- biojs snippets HOT 4
- Regions in x axis are not displayed in plot when length = 1
- Is not possible to have multiple plots in the same page
- Need to clarify licence and/or add LICENCE file HOT 2
- Plotting mutations on upstream of genes
- Download Image Option
- Add / remove data
- Seem to be missing legend? HOT 5
- event hooks HOT 1
- throws error with multiple plots on a page HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from muts-needle-plot.