Closed
Description
my component like this:
<template>
...
</template>
<script>
//some code here
</script>
<style>
.content{
width:500px;
height:600px;
}
</style>
I want to use vue build create umd bundle.
when I use vue build,the result file index.css include
the style content. like this:
vue build my-component.vue --prod --lib
But when I use vue build with webpack.config.js,the style(css) lost
. like this:
vue build my-component.vue --prod --lib --webpack webpack.config.js
My webpack.config.js:
var path = require('path');
var utils = require('./utils');
var webpack = require('webpack');
var merge = require('webpack-merge');
var webpackBaseConfig = require('./webpack.base.conf.js');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
process.env.NODE_ENV = 'production';
module.exports = merge(webpackBaseConfig, {
entry: './index.js',
output: {
path: path.resolve(__dirname, '../dist'),
publicPath: '/dist/',
filename: 'index.js',
library: 'leaflet-map',
libraryTarget: 'umd',
umdNamedDefine: true
},
externals: {
vue: {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue'
}
},
plugins: [
// @todo
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css')
})
]
});
Is something missing from me?
Metadata
Metadata
Assignees
Labels
No labels