-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
module 'tslib' cannot be found
when importing from a sibling directory
#231
Comments
Just to clarify what I mean by this, if I change: export function func({ a }: { a: string }) {
console.log(`Hi ${a}`);
} to: export function func(a: string) {
console.log(`Hi ${a}`);
} it all works as intended. |
FWIW, I think I may have worked around this by adding a |
I guess it is the same reason why my wrapper for rollup throws the same error when I changed |
This comment was marked as off-topic.
This comment was marked as off-topic.
…n in node_modules Please see ezolenko/rollup-plugin-typescript2#231
…n in node_modules Please see ezolenko/rollup-plugin-typescript2#231
module 'tslib' cannot be found
when importing from a sibling directory
This makes sense as newer syntax is not implemented in older versions of ECMAScript and so a "helper" is needed to basically "polyfill" the syntax. TS has its helpers in the Basically, if the syntax you're using isn't supported by your
I checked out the repo and was able to reproduce this. I read the upstream issue linked and this seems to have been solved within TS itself later in that same issue: microsoft/TypeScript#37991 (comment) (PR: microsoft/TypeScript#43166). Upgrading to a newer version of TS (at least v4.3? per the milestones mentioned there) makes this issue go away. For instance, I upgraded to TS It's written there that the issue is due to a "weak check" for the syntax. Your
This also makes sense as a workaround, as then TS would be able to find |
What happens and why it is wrong
This is similar to issue #12, #214, and #216 but none of the solutions mentioned there worked for me and I have clear steps to reproduce so I hope this bug is helpful.
Steps to reproduce:
git clone https://github.com/birtles/rollup-ts-mono
cd rollup-ts-mono/a
yarn install
yarn build
Expected results: it builds successfully.
Actual results:
Note that:
npx tsc
worksyarn test
works butnpx rollup -c
produces the above error)node-resolve
etc. since I don't want the external dependencies to be bundled into the result. (This is for building an AWS lambda function where thenode_modules
will be uploaded along with the compiled file and keeping the compiled file smaller makes debugging easier.)common/func.ts
filetsconfig.json
and extending from it doesn't seem to make a differencepaths
andbaseUrl
as per this comment can seem to help, but appears to break other things.Environment
Node v12.14.0 running on Ubuntu 18.04 under WSL 1.
Versions
rollup.config.js
tsconfig.json
package.json
plugin output with verbosity 3
log:
The text was updated successfully, but these errors were encountered: