Comments (5)
Related: https://medium.com/webpack/webpack-and-rollup-the-same-but-different-a41ad427058c
from britecharts.
I think this is related to an issue I was having - with webpack (& typescript using es2015 modules) I was
import {line} from "britecharts"
but running line()
produced the error line() is not a function
because nothing was being imported.
I solved this by placing an index.js
file in the project's root folder
"use strict";
var bar = require("./dist/umd/bar.min.js");
var brush = require("./dist/umd/brush.min.js");
var colors = require("./dist/umd/colors.min.js");
var donut = require("./dist/umd/donut.min.js");
var legend = require("./dist/umd/legend.min.js");
var line = require("./dist/umd/line.min.js");
var miniTooltip = require("./dist/umd/mini-tooltip.min.js");
var sparkline = require("./dist/umd/sparkline.min.js");
var stackedArea = require("./dist/umd/stacked-area.min.js");
var step = require("./dist/umd/step.min.js");
// var tootltip = require("./dist/umd/tooltip.min.js");
module.exports = {
bar
, brush
, colors
, donut
, legend
, line
, miniTooltip
, sparkline
, stackedArea
, step
// , tooltip
};
and pointing the package.json toward it by changing
"license": "Apache-2.0",
"main": "README.md",
"maintainers": [
to
"license": "Apache-2.0",
"main": "index.js",
"maintainers": [
now everything seems to work, except the tooltip (I haven't figured that out yet) 😃
from britecharts.
Hi @sblack4 thanks for your work there!
Yes, it seems that a solution like yours will work well! We have a couple of PRs that we will merge this weekend with similar solutions. From what I have seen, as we are formatting the output as UMD, the ES2015 modules don't seem to work, but it works as AMD/CommonJS modules or simple JS scripts.
Good call about the 'main'! I will definitely include it on the final solution!
Thanks again for your contribution!!
from britecharts.
Hi @sblack4, this should be solved by now!
Thanks a lot for your insights, we have included the 'main' link too.
from britecharts.
@Golodhros Thanks!
from britecharts.
Related Issues (20)
- Make Storybooks use the right port/url
- jsDelivr broken, package size too large HOT 3
- GroupedBar Chart Toolip Error HOT 4
- Build Update Request
- xTicks is not applying HOT 1
- Does this work with nodejs to produce server side SVG charts? HOT 1
- Loading State for Heatmap HOT 1
- Loading State for Scatter Plot HOT 1
- Refactor Grid Lines to use new Grid helper HOT 7
- Create Changelog for V3
- Move into Monorepo HOT 1
- Move tests into Jest HOT 1
- Deprecate 'nest' function from 'd3-collection'
- Migrate Britecharts to TypeScript
- Make an Accessibility Audit HOT 5
- Research using a third party library for SVG text wrapping
- Time series data on Bar Chart HOT 4
- Cannot set locale on a line chart HOT 5
- Svelte Bindings
- Research Storybook by library or global 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 britecharts.