Giter Club home page Giter Club logo

Comments (5)

miglesiasEB avatar miglesiasEB commented on May 21, 2024

Related: https://medium.com/webpack/webpack-and-rollup-the-same-but-different-a41ad427058c

from britecharts.

sblack4 avatar sblack4 commented on May 21, 2024

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.

Golodhros avatar Golodhros commented on May 21, 2024

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.

Golodhros avatar Golodhros commented on May 21, 2024

Hi @sblack4, this should be solved by now!

Thanks a lot for your insights, we have included the 'main' link too.

from britecharts.

sblack4 avatar sblack4 commented on May 21, 2024

@Golodhros Thanks!

from britecharts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.