The thing is, if your customer does not have legal presence in your country, tax office will likely not care as long as you pay your share of income tax and social security. I live in the EU and work as contractor to overseas companies since 2015, never had issues. I live in big city, I know from colleagues who live in smaller towns they are sometimes tested for tax correctness, but never for the form of their relationship to their customer.
In the same time if your customer does have legal presence in your country of residence then that's entirely different situation amd tax office might see it as tax avoidance, though this will depend on country of your residence as laws are implemented differently in different EU member states, and also the legal form of your own company.
If in doubt, hire accountant who specializes in your area.