Open moritzraho opened 5 years ago
@moritzraho does Webpack have the same issue ? Maybe we can replace Parcel by Webpack for the starter since it's more popular ?
@icaraps thanks for your suggestion. Not sure if it works with webpack we need to try this out. I guess that this issue will be solved in parcel eventually. Also before switching we should do some more comparisons on build time and build size.
I believe webpack would do the same thing unless you changed the mainFields
config option to remove module
entirely. module
takes precedence over main
, and therefore .default
is necessary if you're using a require
. I'd recommend using ES module syntax over require though.
See https://webpack.js.org/configuration/resolve/#resolvemainfields
Relates to https://github.com/parcel-bundler/parcel/issues/2581
Steps to Reproduce
npm install node-fetch
actions/hello/index.js
withscripts/build.actions.js
replaceminify: true,
withminify:false,
npm run build:actions && npm run deploy:actions
fetch is not a function
Note 1:
node-fetch
is exported as an es6 module Note 2: The same action works fine if deployed as a zip actionWorkaround
In the action replace
const fetch = require('node-fetch')
withconst fetch = require('node-fetch').default