Closed SeanHayes closed 3 days ago
When I use import cookie from 'cookie'; in my babel project, when I call cookie.parse('some string') I get: TypeError: Cannot read properties of undefined (reading 'parse')`
import cookie from 'cookie';
cookie.parse('some string') I get:
Any tips for getting this to work? Here's my babel.config.js:
module.exports = function (api) { api.cache(true); return { "presets": [ [ "@babel/preset-env", { "useBuiltIns": "entry", "targets": { "node": "current" }, "ignoreBrowserslistConfig": true } ] ], "ignore": [], "plugins": [ ["babel-plugin-transform-import-meta"], ["module-resolver", { "root": ["./src/**"], "alias": { "~": "./", } }], [ "@babel/plugin-transform-runtime", { "corejs": false, "helpers": true, "regenerator": true } ], "inferno", ["@babel/plugin-proposal-decorators", { "version": "legacy" }], [ "babel-plugin-inline-import", { "extensions": [ ".csv", ".txt" ] } ], ["inline-json-import", {}], [ "babel-plugin-transform-require-ignore", { "extensions": [ ".css", ".scss", ".worker.js" ] } ], "dynamic-import-node" ] }; }
Please see how to import it in the README. Duplicate of https://github.com/jshttp/cookie/issues/195.
When I use
import cookie from 'cookie';
in my babel project, when I callcookie.parse('some string') I get:
TypeError: Cannot read properties of undefined (reading 'parse')`Any tips for getting this to work? Here's my babel.config.js: