-
Notifications
You must be signed in to change notification settings - Fork 61
moment conflict #68
Comments
My current workaround is using a custom replace plugin like so : plugins: [
{
name: 'replace moment imports',
transform: code =>
({
code: code.replace(/import\s*\*\s*as\s*moment/g, 'import moment'),
map: { mappings: '' }
})
},
typescript()
] |
@tamascsaba That is because the namespace import form, import moment from "moment"; Then add |
thx @aluanhaddad && @ghetolay :) |
@ghetolay 's rollup plugin worked for me to resolve the issues I was getting. |
solves the issue but it breaks SystemJS which results in the following message:
Do you know how to configure SystemJS to work with this kind of import? |
Yes but which reversion of SystemJS are you running? it should be working by default no pun intended. Mapping SystemJS.config({
packages: {
"npm:moment": {
format: "cjs"
}
}
}
}); |
For those interested, TypeScript now provides the It is behind a new flag |
Why is this workaround working, then? Seems like a bug in rollup. TypeScript allows to merge function declarations with namespaces, and webpack/ts-node don't have a problem with this. I don't like enabling |
It feels like having to change the codebase which would then break validation in order to accommodate post-processing is a bit of a let-down. Perhaps this can be reconsidered and @ghetolay's workaround could perhaps be added as part of this plugin? -If that's possible at all |
When I use moment with rollup-plugin-typescript, throw an error:
I finded a workaround, but is is not compatible with my editor, underline with red line
https://forum.ionicframework.com/t/error-from-rollup-when-importing-moment-js-with-rc0/64902
Module moment has no default export.
The text was updated successfully, but these errors were encountered: