125 lines
3.0 KiB
JavaScript
125 lines
3.0 KiB
JavaScript
/* eslint-disable no-undef */
|
|
const path = require('path');
|
|
const webpack = require('webpack');
|
|
const GitRevisionPlugin = require('git-revision-webpack-plugin');
|
|
const gitRevisionPlugin = new GitRevisionPlugin();
|
|
|
|
module.exports = {
|
|
|
|
mode: 'development',
|
|
|
|
devtool: 'cheap-module-source-map',
|
|
|
|
entry: {
|
|
'APlayer': './src/js/index.js'
|
|
},
|
|
|
|
output: {
|
|
path: path.resolve(__dirname, '..', 'dist'),
|
|
filename: '[name].js',
|
|
library: '[name]',
|
|
libraryTarget: 'umd',
|
|
libraryExport: 'default',
|
|
umdNamedDefine: true,
|
|
publicPath: '/'
|
|
},
|
|
|
|
resolve: {
|
|
modules: ['node_modules'],
|
|
extensions: ['.js', '.scss']
|
|
},
|
|
|
|
module: {
|
|
strictExportPresence: true,
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
enforce: 'pre',
|
|
loader: 'eslint-loader',
|
|
include: path.resolve(__dirname, '../src/js'),
|
|
},
|
|
{
|
|
test: /\.js$/,
|
|
use: [
|
|
{
|
|
loader: 'babel-loader',
|
|
options: {
|
|
cacheDirectory: true,
|
|
presets: ['env']
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
test: /\.scss$/,
|
|
use: [
|
|
'style-loader',
|
|
{
|
|
loader: 'css-loader',
|
|
options: {
|
|
importLoaders: 1
|
|
}
|
|
},
|
|
{
|
|
loader: 'postcss-loader',
|
|
options: {
|
|
config: {
|
|
path: path.join(__dirname, 'postcss.config.js')
|
|
}
|
|
}
|
|
},
|
|
'sass-loader'
|
|
]
|
|
},
|
|
{
|
|
test: /\.(png|jpg)$/,
|
|
loader: 'url-loader',
|
|
options: {
|
|
'limit': 40000
|
|
}
|
|
},
|
|
{
|
|
test: /\.svg$/,
|
|
loader: 'svg-inline-loader'
|
|
},
|
|
{
|
|
test: /\.art$/,
|
|
loader: 'art-template-loader'
|
|
}
|
|
]
|
|
},
|
|
|
|
devServer: {
|
|
compress: true,
|
|
contentBase: path.resolve(__dirname, '..', 'demo'),
|
|
clientLogLevel: 'none',
|
|
quiet: false,
|
|
open: true,
|
|
historyApiFallback: {
|
|
disableDotRule: true
|
|
},
|
|
watchOptions: {
|
|
ignored: /node_modules/
|
|
}
|
|
},
|
|
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
APLAYER_VERSION: `"${require('../package.json').version}"`,
|
|
GIT_HASH: JSON.stringify(gitRevisionPlugin.version())
|
|
})
|
|
],
|
|
|
|
node: {
|
|
dgram: 'empty',
|
|
fs: 'empty',
|
|
net: 'empty',
|
|
tls: 'empty'
|
|
},
|
|
|
|
performance: {
|
|
hints: false
|
|
}
|
|
|
|
};
|