I'm trying to get babel-polyfill working with for a library but I'm getting the following error:
TypeError: Cannot read property '_babelPolyfill' of undefined
at Object.<anonymous> (/Users/foo/webpack-library-starter/lib/library.js:73:6)
...
I'm using webpack-library-starter as my template.
Full replication details:
git clone https://github.com/krasimir/webpack-library-starter.git
cd webpack-library-starter
npm i
npm i --save babel-polyfill
Tried both adding import 'babel-polyfill'
to the beginning of "src/index.js" and not having it.
Add 'babel-polyfill'
to "webpack.config.js":
entry: ['babel-polyfill', __dirname + '/src/index.js'],
Then build and test:
npm run dev
npm run build
npm test