Cloudflare Pages deployment fails

We’re trying to use Cloudflare Pages for a simple JS app.

Currently the build is failing with the following error message:

|14:39:11.297|> [email protected] build:css|``|---|---|
|14:39:11.297|> postcss src/styles/tailwind.css -o src/styles/main.css|
|14:39:17.269|(function (exports, require, module, __filename, __dirname) { import webpack from 'webpack'|
|14:39:17.269|                                                              ^^^^^^|
|14:39:17.269|SyntaxError: Cannot use import statement outside a module|
|14:39:17.270|    at new Script (node:vm:99:7)|
|14:39:17.270|    at NativeCompileCache._moduleCompile (/opt/buildhome/repo/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)|
|14:39:17.270|    at Module._compile (/opt/buildhome/repo/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:184:36)|
|14:39:17.270|    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)|
|14:39:17.270|    at Module.load (node:internal/modules/cjs/loader:972:32)|

I set up a deployment with Netlify just to see if it would work out of the box and it did so I don’t think we have a configuration that is that out of the ordinary.

It seems to be failing because we have import webpack from 'webpack' at the top of webpack.config.ts but it is not clear why?

Any ideas?

Thanks for any help,


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.