canjs / can-connect

Model layer utilities for every JavaScript framework! Assemble real-time, high performance, restful data connections.
https://canjs.com/doc/can-connect.html
MIT License
29 stars 16 forks source link

can-connect 3.2.x used with CanJS 5 breaks webpack production builds #509

Closed rjgotten closed 4 years ago

rjgotten commented 4 years ago

How often can you reproduce it?

Description: Whenever the cache-requests behavior of can-connect ends up in a Webpack bundle compiled in production mode, a runtime error void(0) is not a function results.

This boils down to a problem where the validate() function is not imported in production builds, but its use was accidentally left outside of the process.env guard.

For CanJS 6 and can-connect 4+ this was fixed in commit https://github.com/canjs/can-connect/commit/6494daa0e6cc27fa2262013e3a1327a15f20832a

Steps to reproduce:

  1. Set up any solution with CanJS 5 and the master can package with webpack
  2. import any can-connect related dependency from the can package which ends up transitively including can-connect/cache-requests/cache-requests.js. E.g. restModel will do.

Expected results: No error is thrown,

Actual results: Error is thrown.

Environment:

Software Version
can-connect version 3.2.5
Browser any
Operating system any
cherifGsoul commented 4 years ago

This was fixed on https://github.com/canjs/can-connect/pull/506