Git Product home page Git Product logo

Comments (5)

Andarist avatar Andarist commented on August 21, 2024

I believe i know what the problem is - gonna prepare a PR to callbag-basics in a moment.

from callbag-start-with.

Andarist avatar Andarist commented on August 21, 2024

Could u confirm for me that its causing u problems when using callbag-basics in webpack@4 project?

Temporarily you could try to use callbag-basics-esmodules instead.

from callbag-start-with.

jorbuedo avatar jorbuedo commented on August 21, 2024

The thing is, I don't use callbag-basics.
I have a react project (using create react app) with webpack 4 and testing with Jest.
Then, I have callbag directory with a package.json with the operators I want to use, and and index.js like the mentioned above. Same as callbag-basics but with all the operators I need.

Everything works fine, importing them as:
import { fromEvent, combine, startWith, map, takeUntil, merge, losslessThrottle, pipe } from 'callbag';

Except that startWith, and the others using ES6, don't work.

I'm looking at the fork using ES6 and it seems overly complicated, with a function to transform everything and requiring babel (otherwise Jest doesn't work). Why not simply use module.exports?

from callbag-start-with.

Andarist avatar Andarist commented on August 21, 2024

module.exports is a commonjs thing which is a legacy module format, if you are doing web development you should try to avoid it because the standard ecmascript module syntax (export/import statements) has some traits which can help to make your application bundles smaller

If you have your own reexporting module you should just convert it to this:

export { default as forEach } from 'callbag-for-each'
export { default as fromObs } from 'callbag-from-obs'
export { default as fromIter } from 'callbag-from-iter'
export { default as fromEvent } from 'callbag-from-event'
export { default as fromPromise } from 'callbag-from-promise'
export { default as interval } from 'callbag-interval'
export { default as map } from 'callbag-map'
export { default as scan } from 'callbag-scan'
export { default as flatten } from 'callbag-flatten'
export { default as take } from 'callbag-take'
export { default as skip } from 'callbag-skip'
export { default as filter } from 'callbag-filter'
export { default as merge } from 'callbag-merge'
export { default as concat } from 'callbag-concat'
export { default as combine } from 'callbag-combine'
export { default as share } from 'callbag-share'
export { default as pipe } from 'callbag-pipe'

And I believe it should work for you.

from callbag-start-with.

jorbuedo avatar jorbuedo commented on August 21, 2024

I changed my index to the new syntax and now both old and new callbags seem to work.
Thanks!

from callbag-start-with.

Related Issues (1)

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.