123456789101112131415161718192021222324252627 |
- const webpack = require('webpack');
- const withTM = require('next-transpile-modules');
- module.exports = withTM({
- transpileModules: ['query-string', 'split-on-first', 'strict-uri-encode'],
- webpack: (config) => {
- const originalEntry = config.entry;
- config.entry = async () => {
- const entries = await originalEntry();
- if (
- entries['main.js'] &&
- !entries['main.js'].includes('./polyfills.js')
- ) {
- entries['main.js'].unshift('./polyfills.js')
- }
- return entries;
- };
- config.plugins.push(
- new webpack.DefinePlugin({
- 'process.env.ENV': JSON.stringify(process.env.ENV),
- }),
- );
- return config;
- },
- });
|