Files
handlebars.js/tests/integration/webpack-test/test.sh
T
Jakob Linskeseder e3a54485db Fix bundler issue with webpack 5
As explained in issue #1844 and in issue
https://github.com/webpack/webpack/issues/15007#issuecomment-996615250,
the way we used the `browser`-field was wrong.

The main reason for using the `browser`-field is the requirement of
`require('fs')` in the main-entry-file.
The workaround for this was using `require('handlebars/lib/handlebars')`,
but now it will also work via `require('handlebars')` for bundlers that
respect the `browser`-field.

The `"./runtime"`-config was removed, because it didn't have any effect.
In order to detect regressions, the webpack-integration test was
extended to test with different webpack versions.

Fixes #1174
Closes #1844
2022-05-17 21:19:48 +02:00

27 lines
567 B
Bash
Executable File

#!/bin/bash
set -e
run_tests () {
for i in dist/*-test.js ; do
echo "----------------------"
echo "-- Running $i"
echo "----------------------"
node "$i"
echo "Success"
done
}
# Cleanup: package-lock and "npm ci" is not working with local dependencies
rm dist package-lock.json -rf
npm install --legacy-peer-deps
# Test with webpack 4
npm install --legacy-peer-deps --no-save webpack@^4 webpack-cli@^3
npm run build
run_tests
# Test with webpack 5
npm install --legacy-peer-deps --no-save webpack@^5 webpack-cli@^4
npm run build
run_tests