chore: update workflow

This commit is contained in:
DIYgod
2019-09-25 19:08:57 +08:00
parent 6f4cece562
commit 8ff2095ff6
24 changed files with 6730 additions and 3861 deletions
+29 -38
View File
@@ -1,17 +1,17 @@
/* eslint-disable no-undef */
const path = require('path');
const webpack = require('webpack');
const GitRevisionPlugin = require('git-revision-webpack-plugin');
const gitRevisionPlugin = new GitRevisionPlugin();
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
module.exports = {
mode: 'development',
devtool: 'cheap-module-source-map',
entry: {
'APlayer': './src/js/index.js'
APlayer: './src/js/index.js',
},
output: {
@@ -21,23 +21,17 @@ module.exports = {
libraryTarget: 'umd',
libraryExport: 'default',
umdNamedDefine: true,
publicPath: '/'
publicPath: '/',
},
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.scss']
extensions: ['.js', '.scss'],
},
module: {
strictExportPresence: true,
rules: [
{
test: /\.js$/,
enforce: 'pre',
loader: 'eslint-loader',
include: path.resolve(__dirname, '../src/js'),
},
{
test: /\.js$/,
use: [
@@ -45,10 +39,10 @@ module.exports = {
loader: 'babel-loader',
options: {
cacheDirectory: true,
presets: ['env']
}
}
]
presets: ['@babel/preset-env'],
},
},
],
},
{
test: /\.scss$/,
@@ -57,36 +51,34 @@ module.exports = {
{
loader: 'css-loader',
options: {
importLoaders: 1
}
importLoaders: 1,
},
},
{
loader: 'postcss-loader',
options: {
config: {
path: path.join(__dirname, 'postcss.config.js')
}
}
plugins: [autoprefixer, cssnano],
},
},
'sass-loader'
]
'sass-loader',
],
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader',
options: {
'limit': 40000
}
limit: 40000,
},
},
{
test: /\.svg$/,
loader: 'svg-inline-loader'
loader: 'svg-inline-loader',
},
{
test: /\.art$/,
loader: 'art-template-loader'
}
]
loader: 'art-template-loader',
},
],
},
devServer: {
@@ -96,29 +88,28 @@ module.exports = {
quiet: false,
open: true,
historyApiFallback: {
disableDotRule: true
disableDotRule: true,
},
watchOptions: {
ignored: /node_modules/
}
ignored: /node_modules/,
},
},
plugins: [
new webpack.DefinePlugin({
APLAYER_VERSION: `"${require('../package.json').version}"`,
GIT_HASH: JSON.stringify(gitRevisionPlugin.version())
})
GIT_HASH: JSON.stringify(gitRevisionPlugin.version()),
}),
],
node: {
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty'
tls: 'empty',
},
performance: {
hints: false
}
hints: false,
},
};