rsnext/scripts/next-with-deps.sh
Balázs Orbán 8bf082a913
fix: loosen webpack compilation with fallbackNodePolyfills: false (#40612)
If in `resolve.fallback` we set previously polyfilled modules to `false`
instead of an empty object, webpack will pass the compilation _and_ not
include any polyfills.

Fixes #40522, fixes #40364

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-09-16 13:23:56 -07:00

39 lines
849 B
Bash
Executable file

#!/bin/bash
START_DIR=$PWD
# gets last argument which should be the project dir
for PROJECT_DIR in $@;do :;done
if [ -z $PROJECT_DIR ];then
echo "No project directory provided, exiting..."
exit 1;
fi;
if [ ! -d $PROJECT_DIR ];then
echo "Invalid project directory provided, exiting..."
exit 1;
fi;
if [ $PROJECT_DIR == $PWD ] || [ "$PROJECT_DIR" == "." ];then
echo "Project directory can not be root, exiting..."
exit 1;
fi;
CONFLICTING_DEPS=("react" "react-dom" "styled-jsx" "next")
for dep in ${CONFLICTING_DEPS[@]};do
if [ -d "$PROJECT_DIR/node_modules/$dep" ];then
HAS_CONFLICTING_DEP="yup"
fi;
done
if [ ! -z $HAS_CONFLICTING_DEP ] || [ ! -d "$PROJECT_DIR/node_modules" ];then
cd $PROJECT_DIR
pnpm install
for dep in ${CONFLICTING_DEPS[@]};do
rm -rf node_modules/$dep
done
fi
cd $START_DIR
pnpm next $@