Skip to content

webpack 4 tree-shaking style sideEffects: Fix #1527

Open
@thelonecabbage

Description

@thelonecabbage

What problem does this feature solve?

Essentially it's an instruction to the vue-loader to import and use the style from the same file (recursively). The resulting value of style is {}, but it **tricks webpack into thinking the style in this file is not a side-effect.

What does the proposed API look like?

-- file: Palette.vue ---

<script>
import style from './Palette.vue?vue&type=style&index=0&module=true&lang=stylus&'

export default {
   style,
   ...
}
</script>
<style scoped lang="stylus">
...
</style>

It could be possible to append a similar import to the front of the script section automatically in the vue-loader, thereby making the style mandatory .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions