masonry icon indicating copy to clipboard operation
masonry copied to clipboard

vite build fails

Open verschoof opened this issue 1 year ago • 1 comments

error during build:
Could not resolve "./item" from "./item?commonjs-external"
file: ./item?commonjs-external
    at getRollupError (file:///opt/project/node_modules/rollup/dist/es/shared/parseAst.js:392:41)
    at error (file:///opt/project/node_modules/rollup/dist/es/shared/parseAst.js:388:42)
    at ModuleLoader.handleInvalidResolvedId (file:///opt/project/node_modules/rollup/dist/es/shared/node-entry.js:19273:24)
    at file:///opt/project/node_modules/rollup/dist/es/shared/node-entry.js:19233:26
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make: *** [node] Error 1

verschoof avatar Oct 05 '24 19:10 verschoof

I have resolved this by patching the module locally using pnpm patch... you can achieve the same thing with patch-package.

This problem is the require('./item') in dist/masonry.pkgd.js.

diff --git a/dist/masonry.pkgd.js b/dist/masonry.pkgd.js
index 4274bfc194d4012703cb47e33cf81c96244ff092..39df9232e57ccffbe64731629792740acba41cb4 100644
--- a/dist/masonry.pkgd.js
+++ b/dist/masonry.pkgd.js
@@ -1338,7 +1338,7 @@ return Item;
         'ev-emitter/ev-emitter',
         'get-size/get-size',
         'fizzy-ui-utils/utils',
-        './item'
+        // './item'
       ],
       function( EvEmitter, getSize, utils, Item ) {
         return factory( window, EvEmitter, getSize, utils, Item);
@@ -1351,7 +1351,7 @@ return Item;
       require('ev-emitter'),
       require('get-size'),
       require('fizzy-ui-utils'),
-      require('./item')
+      // require('./item')
     );
   } else {
     // browser global

karlvr avatar Jan 17 '25 22:01 karlvr