This directory contains integration tests to verify that
@googlemaps/js-api-loader works correctly with popular JavaScript bundlers
without requiring any configuration from consumers.
The @googlemaps/js-api-loader library has a development-mode (based on
process.env.NODE_ENV checks) that toggle detailed warning messages during
development.
The tests in this directory ensure that some of the most popular bundlers correctly handle the development mode in a default configuration.
- Vite - Correctly replaces
process.env.NODE_ENVvia its built-indefineconfig - Webpack - Correctly replaces it via DefinePlugin (default behavior)
- Rollup - Works with standard
@rollup/plugin-replaceconfiguration
The tests verify both modes:
- Production mode:
process.env.NODE_ENVis replaced, dev warnings are removed - Development mode:
process.env.NODE_ENVis replaced with"development", dev warnings are preserved
./test-all.shcd vite-test
npm install
npm install $(npm pack --silent ../../)
npm run build- Uses Vite's zero-config setup
- Relies on Vite's automatic
process.env.NODE_ENVreplacement - development mode is approximated by disabling minification and building with
NODE_ENV='development' vite build --mode development
- Uses Webpack 5 with minimal config
- Relies on DefinePlugin (enabled by default in production mode)
- Uses standard Rollup with
@rollup/plugin-replace - Represents how users typically configure Rollup
All tests should pass with:
✓ All bundler tests passed!
If any test fails, it means the library is shipping code that won't work correctly in that bundler without additional user configuration.