A
A
Alexey Nikolaev2020-01-14 01:32:12
webpack
Alexey Nikolaev, 2020-01-14 01:32:12

Is correct treeshaking possible with vue-cli-service?

Goodnight.
There is a small package of utilities, import from it.

import { formateDate, fromNow } from '@vendor/utils/date'

There are only 3 functions in the package. There is also a fromTo function, which is not used in the project.
Webpack builds the project from under the vue-cli-service, creates chunks, which include chunk-vendors.js, which contains just the right imports from vendors. The problem is this: despite the fact that the project does not have a fromTo import from '@vendor/utils/date', chunk-vendors.js still has this function.
The situation is the same with all other third-party packages. This leads to bloat in the size of the bundle, even though it is multipage, due to the inclusion of functions and methods in it that are not actually used anywhere and will never be called.
How to fight? Are there ways? As I understand it, treeshaking does not work \ is not configured?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question