I'm migrating from Webpack to Parcel and I use folder aliases like this in my component:
import * as authActions from 'actions/authActions';
I get this error: Cannot find module 'actions/authActions'
The weird thing is, it only shows when using build
, it works in development mode but not in production.
I've set up my aliases in package.json like the docs say:
{
"scripts: {
"build-client": "parcel build client/index.html dist/client",
"build-server": "parcel build server/index.js --target node -d dist/server",
"build-test": "yarn build-server && node ./dist/server/index.js"
},
"alias": {
"actions": "./client/actions"
}
}
It's a server-side rendered app, I'm importing the component in different places and I can't use the default Parcel root, because it's relative to the entry file.
How can I get this to properly resolve aliases?