Open stevemao opened 5 years ago
Hey any news about this ? Webpack outputs a package.json with empty dependencies numbers when they are from my aliased package with it's own package.json
. Figured I need a way to tell webpack to look for version number in both local and linked package.json
. Can we do this with the plugin ?
Couldn't get it to work, so I switched to serverless-jetpack and serverless-scriptable-plugin
Too bad, what was wrong ? Did you try to PR an implementation in packExternalMoules.js
? Do you have an example repo of your configuration serverless-jetpack and serverless-scriptable-plugin ?
I also had the problem that not the right dependencies were package into during deployment. Furthermore the yarn.lock
file was ignored. I'm too unexperienced on the serverless plugins to be able to file a PR. And honestly I was also just looking for something that works out of the box or with not much configuration and the serverless-jetpack-plugin, in combination with the serverless-scriptable-plugin solved it for me.
All I had to do there, was to change my serverless.ym files (I have on serverless.yml in each package):
custom:
scriptHooks:
# These are all the places that jetpack could be invoked that would
# ensure the TS files are built right before jetpack kicks in.
# Hooks Cheat Sheet: https://gist.github.com/HyperBrain/50d38027a8f57778d5b0f135d80ea406#file-lifecycle-cheat-sheet-md
before:invoke:local:invoke: yarn run build
before:package:createDeploymentArtifacts: yarn run build
before:package:function:package: yarn run build
before:jetpack:package:package: yarn run build
jetpack:
base: "../.."
preInclude:
- "!**" # Start with absolutely nothing (typical in monorepo scenario)
package:
individually: true
And yarn build
just runs tsc -b tsconfig.json
I have a mono repo like this
packages
I have a module in package-2 that requires some module in package-1 like this:
require('../package-1/index')
And I'd like to exclude both node_modules of package-1 and package-2 when I build package-2.
I can externalise both with webpack:
Would be good if I could do something like this: