2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-06-21 23:50:35 +03:00

refactor: 2.0

This commit is contained in:
mxie
2018-06-16 10:11:13 +08:00
parent d28d307def
commit 96fffcab04
39 changed files with 10988 additions and 2969 deletions
+48
View File
@@ -0,0 +1,48 @@
const path = require('path')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
module.exports = {
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'@': path.join(__dirname, '..', 'src')
}
},
module: {
rules: [
{
test: /\.vue$/,
use: [
{
loader: 'vue-loader',
options: {
}
}
]
},
{
test:/\.scss$/,
use: ['vue-style-loader', 'css-loader', 'postcss-loader', 'sass-loader']
},
{
test: /\.js$/,
use: ['babel-loader'],
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
}
]
},
plugins: [
new VueLoaderPlugin()
]
}
+13
View File
@@ -0,0 +1,13 @@
const merge = require('webpack-merge')
const devWebpackConfig = require('./webpack.dev.config.js')
const webpackConfig = merge(devWebpackConfig, {
devtool: 'source-map',
mode: 'production'
externals: {
'vue': 'Vue',
'@/index': 'DatePicker'
},
})
module.exports = webpackConfig
+50
View File
@@ -0,0 +1,50 @@
const path = require('path')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.config.js')
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const webpackConfig = merge(baseWebpackConfig, {
mode: 'production',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, '../lib'),
filename: 'index.js',
library: "DatePicker",
libraryTarget: "umd"
},
plugins: [
new OptimizeCSSPlugin({
cssProcessorOptions: { safe: true }
})
]
})
const webpackConfigExtractCss = merge(baseWebpackConfig, {
mode: 'production',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, '../lib'),
filename: 'datepicker.js',
library: "DatePicker",
libraryTarget: "umd"
},
module: {
rules: [
{
test:/\.scss$/,
use: [ MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader', 'sass-loader']
},
]
},
plugins: [
new MiniCssExtractPlugin({
filename: 'datepicker.css'
}),
new OptimizeCSSPlugin({
cssProcessorOptions: { safe: true }
})
]
})
module.exports = [ webpackConfig, webpackConfigExtractCss]
+30
View File
@@ -0,0 +1,30 @@
const path = require('path')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.config.js')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const webpackConfig = merge(baseWebpackConfig, {
mode: 'development',
entry: './demo/index.js',
output: {
path: path.resolve(__dirname, '../demo'),
filename: 'build.js'
},
externals: {
'vue': 'Vue'
},
devServer: {
historyApiFallback: {
index: './demo/index.html'
},
noInfo: true,
port: 9000
},
performance: {
hints: false
},
devtool: 'cheap-module-eval-source-map'
})
module.exports = webpackConfig