I want to use TypeScript and LESS transpilers in my Salesforce DX projects. Unfortunately, when I try to push with .less or .ts files anywhere in my project source folder, it fails with the following error.

sfdx force:source:push
ERROR:  Unexpected file found in package directory:
sfdx force:source:push ended with exit code 1

I assume I could go all the way to the root and create a parallel project with a mirrored directory tree, and transpile across to the sibling, but the thought of maintaining identical folders isn't pleasant.

I also thought of transpiling and copying everything automatically, into a folder that is actually used for for push. The problem with that is it would defeat the ability to pull layouts, and therefore to use the web-based visual layout editing.


Specify a .forceignore file in your project root folder.

See How to Exclude Source When Syncing or Converting for more information.

As a generic example, to ignore LESS files, put the following into .forceignore:


This is similar to the syntax that git uses in its .gitignore file; this was done intentionally to minimize the learning curve for people already familiar with git (especially given that we're advised to use git for an easier experience with DX, though we can certainly use other systems if we prefer).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.