diff --git a/next.config.js b/next.config.js index 7d5cf62a..a5d56171 100644 --- a/next.config.js +++ b/next.config.js @@ -5,9 +5,17 @@ const webpack = require("webpack"); const apiKey = JSON.stringify(process.env.SHOPIFY_API_KEY); module.exports = withCSS({ - webpack: config => { + webpack: (config) => { const env = { API_KEY: apiKey }; config.plugins.push(new webpack.DefinePlugin(env)); + + // Add ESM support for .mjs files in webpack 4 + config.module.rules.push({ + test: /\.mjs$/, + include: /node_modules/, + type: "javascript/auto", + }); + return config; - } + }, });