Component style block is ignored in production
Version
3.3.0
Reproduction link
https://github.com/aiyk-web-components/awc-custom-table
Environment info
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Binaries:
Node: 8.12.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.12.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.5.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 42.17134.1.0
npmPackages:
@vue/babel-helper-vue-jsx-merge-props: 1.0.0-beta.1
@vue/babel-plugin-transform-vue-jsx: 1.0.0-beta.1
@vue/babel-preset-app: 3.3.0
@vue/babel-preset-jsx: 1.0.0-beta.1
@vue/babel-sugar-functional-vue: 1.0.0-beta.1
@vue/babel-sugar-inject-h: 1.0.0-beta.1
@vue/babel-sugar-v-model: 1.0.0-beta.1
@vue/babel-sugar-v-on: 1.0.0-beta.1
@vue/cli-overlay: 3.3.0
@vue/cli-plugin-babel: ^3.3.0 => 3.3.0
@vue/cli-plugin-eslint: ^3.3.0 => 3.3.0
@vue/cli-service: ^3.3.0 => 3.3.0
@vue/cli-shared-utils: 3.3.0
@vue/component-compiler-utils: 2.5.0
@vue/preload-webpack-plugin: 1.1.0
@vue/web-component-wrapper: 1.2.0
babel-helper-vue-jsx-merge-props: 2.0.3
babel-plugin-transform-vue-jsx: 4.0.1
eslint-plugin-vue: ^5.0.0 => 5.1.0
vue: ^2.5.21 => 2.5.21
vue-eslint-parser: 2.0.3
vue-hot-reload-api: 2.3.1
vue-loader: 15.5.1
vue-style-loader: 4.1.2
vue-template-compiler: ^2.5.21 => 2.5.21
vue-template-es2015-compiler: 1.7.0
npmGlobalPackages:
@vue/cli: Not Found
Steps to reproduce
BUILD (npm run build-bundle)
PUBLISH TO NPM (npm publish --access public)
INSTALL IN A NEW PROJECT - (npm i awc-table)
USE - <AwcCustomTable></AwcCustomTable>
What is expected?
styled custom table should load with a few dummy data
What is actually happening?
table loads without style rules
My thoughts is that the build process ignores the style block in my vue components, not sure why
https://cli.vuejs.org/guide/build-targets.html#library
dist/myLib.css: Extracted CSS file (can be forced into inlined by settingcss: { extract: false }invue.config.js)
thanks @sodatea setting css: { extract: false } actually did the magic
Hi @sodatea / @aiyk How can I Publish "Individual Components" (separate css / js)
My current Vue CLI Buil is vue-cli-service build --target lib --name vue-yami ./src/index.js
Problem: when import a component like
import { UiSelect } from "@mylibrary/vue-components"
other components css are imported unnecessarily
QUESTION: how can publish to npm to import only neccesary code for each component ?
Thanks !!