Open SRoeffaers opened 6 years ago
You shouldn’t import this file if you are using tree-shaking. Just import {stashConverters} from “can”
There's probably still a bug here worth looking into though.
But I won't be doing anything with 'stashConverters'.. It's just needed in the stache-files. My linter will mark it as an unused variable..
@Kleppo do this:
import { stache, stacheConverters } from 'can';
stache.addConverter(stacheConverters);
Ah thx, good idea! :-)
I think I've encountered this as well.
My workaround was to, in the context of this example, add to package.json
:
"dependencies": {
---snip---
"can-stache-converters": "*",
---snip---
}
I think this tells steal to include that module, so it doesn't get thrown away during tree shake, but I'm not really sure. The "*"
means "any" version, so whatever version of that package included with can
. Here are the modules I'm doing this for to avoid the errors that would otherwise appear:
"can-connect": "*",
"can-event-dom-enter": "*",
"can-stache-route-helpers": "*",
Is this actually a solution? Is there a negative to doing this?
When I for examle do this:
import 'can/es/can-stache-converters';
It doesn't work when I build it with tree shaking enabled. When I disable tree shaking, it does work. I think it can't handle module imports without explicit named imports