Vue-cli: Unused export removed from build library target

Created on 2 Jun 2018  路  2Comments  路  Source: vuejs/vue-cli

Version

3.0.0-beta.15

Reproduction link

https://github.com/lossendae/vue-table

Steps to reproduce

I want to expose 2 components and 2 mixins from my library (and eventually later, when its working, move the install function as well, in order to set the default import to VueTable)

When i build the library with vue-cli-service build --target lib --name VueTable src/main.js the install function is available but none of the 4th exports

What is expected?

I would like to be able to import the modules with import { VueTable, vueTableMixin, VueTablePagination, vueTablePaginationMixin } from '@lossendae/vue-table'

What is actually happening?

Any of those imports return undefined


This look like an issue with tree shaking. I tested a bunch of config options locally via the vue.config.js file but to no avail :

module.exports = {
    chainWebpack: config => {
            config.optimization.removeAvailableModules(false)
            config.optimization.concatenateModules(false)
            config.optimization.providedExports(false)
            config.optimization.providedExports(false)
            config.optimization.usedExports(false)
            config.optimization.sideEffects(false)
            config.optimization.minimize(false)
            config.optimization.flagIncludedChunks(false)
    },
}
bug cli-service build

Most helpful comment

@lossendae @Patcher56 Make sure to see the commit message of https://github.com/vuejs/vue-cli/commit/1dc47eb955eaefe2a62d2706b1449b8e4d21788b .

All 2 comments

@lossendae @Patcher56 Make sure to see the commit message of https://github.com/vuejs/vue-cli/commit/1dc47eb955eaefe2a62d2706b1449b8e4d21788b .

It worked like a charm, thank you Evan!

Was this page helpful?
0 / 5 - 0 ratings