Yomguithereal / baobab

JavaScript & TypeScript persistent and optionally immutable data tree with cursors.
MIT License
3.15k stars 117 forks source link

Using Baobab 2.5.1 is causing babel to fail #501

Closed debugmaster closed 6 years ago

debugmaster commented 6 years ago

I don't have much information yet, but last version is causing babel transpilation to fail with following error: Options {"loose":true} passed to <project-folder>/node_modules/babel-preset-es2015/index.js which does not accept options.

The issue could be just be on babel, babelify, or in the project it has happened (quite a big one), so I created just the issue for now.

I will try to gather some more information. For now, I changed to use 2.4.x.

Yomguithereal commented 6 years ago

Well this indeed a problem :). 2.5.0 should be ok though. Let me check that.

ghost commented 6 years ago

2.5.1 is broken period. Now when I require Baobab I get an object with a single 'default' key.

> let B = require('baobab')
undefined
> B
{ default: 
   { [Function: Baobab]
     monkey: [Function],
     dynamicNode: [Function],
     Cursor: [Function: Cursor],
     MonkeyDefinition: [Function: MonkeyDefinition],
     Monkey: [Function: Monkey],
     type: 
      { array: [Function],
        object: [Function],
        string: [Function],
        number: [Function],
        function: [Function],
        primitive: [Function],
        splicer: [Function],
        path: [Function],
        dynamicPath: [Function],
        monkeyPath: [Function],
        lazyGetter: [Function],
        monkeyDefinition: [Function],
        watcherMapping: [Function],
        operationType: [Function] },
     helpers: 
      { Archive: [Function: Archive],
        shallowClone: [Function: bound cloner],
        deepClone: [Function: bound cloner],
        freeze: [Function: bound freezer],
        deepFreeze: [Function: bound freezer],
        shallowMerge: [Function: bound merger],
        deepMerge: [Function: bound merger],
        uniqid: [Function],
        arrayFrom: [Function: arrayFrom],
        before: [Function: before],
        coercePath: [Function: coercePath],
        getIn: [Function: getIn],
        makeError: [Function: makeError],
        hashPath: [Function: hashPath],
        solveRelativePath: [Function: solveRelativePath],
        solveUpdate: [Function: solveUpdate],
        splice: [Function: splice] },
     VERSION: '2.5.0' } }

This is 2.5.1, what's 'default'? Sounds like something meant for the 'import' syntax (e.g. exporting something as default) but I don't think it works like this. (btw version number is wrong, should be 2.5.1)

Importing 2.5.0 works as expected:

> let B = require('baobab')
undefined
> B
{ [Function: Baobab]
  monkey: [Function],
  dynamicNode: [Function],
  Cursor: [Function: Cursor],
  MonkeyDefinition: [Function: MonkeyDefinition],
  Monkey: [Function: Monkey],
  type: 
   { array: [Function],
     object: [Function],
     string: [Function],
     number: [Function],
     function: [Function],
     primitive: [Function],
     splicer: [Function],
     path: [Function],
     dynamicPath: [Function],
     monkeyPath: [Function],
     lazyGetter: [Function],
     monkeyDefinition: [Function],
     watcherMapping: [Function],
     operationType: [Function] },
  helpers: 
   { arrayFrom: [Function: arrayFrom],
     before: [Function: before],
     coercePath: [Function: coercePath],
     getIn: [Function: getIn],
     makeError: [Function: makeError],
     solveRelativePath: [Function: solveRelativePath],
     solveUpdate: [Function: solveUpdate],
     splice: [Function: splice],
     Archive: [Function: Archive],
     shallowClone: [Function: bound cloner],
     deepClone: [Function: bound cloner],
     freeze: [Function: bound freezer],
     deepFreeze: [Function: bound freezer],
     shallowMerge: [Function: bound merger],
     deepMerge: [Function: bound merger],
     uniqid: [Function] },
  VERSION: '2.5.0' }
Yomguithereal commented 6 years ago

I just released a v2.5.2 that should fix the issue. Can you both test it and tell me if it works for you.

@debugmaster you should probably add /node_modules/ to the ignore setting in webpack so you don't attempt to transpile dependencies.

ghost commented 6 years ago

Thank you so much! I'm at work so no, not for several hours, but I will as soon as possible.

ghost commented 6 years ago

Yeah it works! Thanks.