Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Component style missing after tree-shaking  #104

Closed
@krimeshu

Description

@krimeshu

hello.vue:

<template>
    <div class="container">
        <p v-for="item in list" :data-total="total">
            {{item}}
        </p>    
    </div>
</template>

<script>
export default {
    data: function () {
        return {
            list: ['hello', 'world'],
            total: 123
        }
    }
}
</script>

<style scoped>
.container {
    background: #eff;
}
</style>

entry.js:

import hello from './hello.vue';

new Vue({
    el: '#vueApp',
    components: { hello },
    template: `
        <hello/>
    `
})

Expected behavior

Compile .vue to .js, contains style parts.

Actual behavior

Generated .js doesn't contains style parts.

var hello = { render: function render() {
        var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('div', { staticClass: "container" }, _vm._l(_vm.list, function (item) {
            return _c('p', { attrs: { "data-total": _vm.total } }, [_vm._v(_vm._s(item))]);
        }));
    }, staticRenderFns: [], _scopeId: 'data-v-9d9be692',
    data: function data() {
        return {
            list: ['hello', 'world'],
            total: 123
        };
    }
};

new vue$1({
    el: '#vueApp',
    components: { hello: hello },
    template: '\n        <hello/>\n    '
});

Steps to reproduce the behavior

Use gulp-better-rollup with rollup-plugin-vue to compile entry.js.

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