Skip to content
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

Destiny's trying to restructure scss files #63

Closed
AnatoleLucet opened this issue Feb 23, 2020 · 3 comments · Fixed by #66
Closed

Destiny's trying to restructure scss files #63

AnatoleLucet opened this issue Feb 23, 2020 · 3 comments · Fixed by #66
Labels

Comments

@AnatoleLucet
Copy link
Collaborator

AnatoleLucet commented Feb 23, 2020

By now, Destiny could easily restructure scss files. And it seems like it's trying, without knowing, but not succeeding.

If a js/ts file imports a scss file like so:

import './index.scss';

and this index.scss is importing another scss file without specifying the .scss extension in the path:

@import './foo';

it will throw this error:

(node:9201) UnhandledPromiseRejectionWarning: Error: Cannot find module './foo' from '/home/anatole/dev/destiny-cra/src/index'
    at Function.resolveSync [as sync] (/home/anatole/.npm/_npx/9201/lib/node_modules/destiny/node_modules/resolve/lib/sync.js:81:15)
    at customResolve (/home/anatole/.npm/_npx/9201/lib/node_modules/destiny/lib/destiny.js:144:18)
    at /home/anatole/.npm/_npx/9201/lib/node_modules/destiny/lib/destiny.js:182:33
    at Array.forEach (<anonymous>)
    at buildGraph (/home/anatole/.npm/_npx/9201/lib/node_modules/destiny/lib/destiny.js:175:21)
    at formatFileStructure (/home/anatole/.npm/_npx/9201/lib/node_modules/destiny/lib/destiny.js:534:9)
    at run (/home/anatole/.npm/_npx/9201/lib/node_modules/destiny/lib/destiny.js:650:9)
    at Object.<anonymous> (/home/anatole/.npm/_npx/9201/lib/node_modules/destiny/lib/destiny.js:654:3)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
(node:9201) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:9201) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

So the question is: are we extending to preprocessors like Prettier, or are we ignoring non js/ts files?


I made a repo to replicate:
https://github.com/AnatoleLucet/destiny-scss-error
Simply clone it, and run npm destiny src

@AnatoleLucet
Copy link
Collaborator Author

The above error also happens when a file contains an import to a non existing file. We should handle this error with the logger.

@benawad
Copy link
Owner

benawad commented Feb 24, 2020

I think it's worth supporting that, should be almost exactly the same thing as js/ts

I think we need to add the extension to

extensions: [".js", ".jsx", ".ts", ".tsx", ".svg"], // .svg is for create-react-app

sQVe added a commit that referenced this issue Feb 24, 2020
This commit fixes #63.
@sQVe sQVe closed this as completed in #66 Feb 24, 2020
@github-actions
Copy link

🎉 This issue has been resolved in version 0.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants