Node module css import paths work in development, but not in production

I am moving from Webpack to esbuild with jsbundling-rails & cssbundling-rails.

I have a folder which imports css libraries from vendors like so:

@import "drift-zoom/dist/drift-basic.min.css";
@import "dropzone/dist/min/dropzone.min.css";
@import "select2/dist/css/select2.css";

This works without issue in development, but in production I get an errors like:

ActionController::RoutingError (No route matches [GET] "/assets/select2/dist/css/select2.css"):

The problem is clearly that it is looking for theses file in assets, when instead it should be looking in the node_modules folder at the root directory.

I have Rails.application.config.assets.paths << Rails.root.join('node_modules') in config/initializers/assets.rb

How should these import paths be written to work in production too? Or am I missing something in my setup?

My package.json script for css is:

"build:css": "sass ./app/assets/stylesheets/application.sass.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules"
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum