harttle / liquidjs

A simple, expressive, safe and Shopify compatible template engine in pure JavaScript.
https://liquidjs.com
MIT License
1.51k stars 240 forks source link

Critical Dependency Warning #627

Closed Maanil-Verma-WIN closed 2 months ago

Maanil-Verma-WIN commented 1 year ago

I am working with NextJS 13, Material UI, and TypeScript & I am getting this warning in my VS Code Terminal Again and again.

warn  - ./node_modules/liquidjs/dist/liquid.node.cjs.js
**Critical dependency: require function is used in a way in which dependencies cannot be statically extracted**

Import trace for requested module:
./node_modules/liquidjs/dist/liquid.node.cjs.js
./shared-components/ComponentA.tsx
./shared-components/ComponentB.tsx
./shared-components/ComponentC.tsx
./shared-components/ComponentD.tsx
./app/components/(dashboard-app)/dashboard/components/ComponentE.tsx
./app/component/(dashboard-app)/dashboard/ComponentF.tsx
harttle commented 1 year ago

It's related to a functionality to load partial templates via require.resolve, we'll have an option to remove this functionality in the next major release. Need more discussion on this.

There's a way to mitigate the warning from stackoverflow, add a plugin to Webpack config:

  plugins: [
    new ContextReplacementPlugin(/liquidjs/)
  ],

See a demo config here.