2016-10-26 16:46:32 +02:00
|
|
|
var path = require('path')
|
|
|
|
var config = require('../config')
|
|
|
|
var utils = require('./utils')
|
|
|
|
var projectRoot = path.resolve(__dirname, '../')
|
2018-12-12 18:03:50 +01:00
|
|
|
var ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin')
|
2019-12-03 16:32:46 +01:00
|
|
|
var FontelloPlugin = require("fontello-webpack-plugin")
|
2016-10-26 16:46:32 +02:00
|
|
|
|
|
|
|
var env = process.env.NODE_ENV
|
|
|
|
// check env & config/index.js to decide weither to enable CSS Sourcemaps for the
|
|
|
|
// various preprocessor loaders added to vue-loader at the end of this file
|
|
|
|
var cssSourceMapDev = (env === 'development' && config.dev.cssSourceMap)
|
|
|
|
var cssSourceMapProd = (env === 'production' && config.build.productionSourceMap)
|
|
|
|
var useCssSourceMap = cssSourceMapDev || cssSourceMapProd
|
|
|
|
|
2019-12-03 16:32:46 +01:00
|
|
|
var now = Date.now()
|
|
|
|
|
2016-10-26 16:46:32 +02:00
|
|
|
module.exports = {
|
|
|
|
entry: {
|
|
|
|
app: './src/main.js'
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: config.build.assetsRoot,
|
|
|
|
publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
|
|
|
|
filename: '[name].js'
|
|
|
|
},
|
2019-04-28 21:03:03 +02:00
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
chunks: 'all'
|
|
|
|
}
|
|
|
|
},
|
2016-10-26 16:46:32 +02:00
|
|
|
resolve: {
|
2019-04-07 19:33:11 +02:00
|
|
|
extensions: ['.js', '.vue'],
|
|
|
|
modules: [
|
|
|
|
path.join(__dirname, '../node_modules')
|
|
|
|
],
|
2016-10-26 16:46:32 +02:00
|
|
|
alias: {
|
2017-02-21 11:48:08 +01:00
|
|
|
'vue$': 'vue/dist/vue.runtime.common',
|
2016-10-26 16:46:32 +02:00
|
|
|
'src': path.resolve(__dirname, '../src'),
|
|
|
|
'assets': path.resolve(__dirname, '../src/assets'),
|
|
|
|
'components': path.resolve(__dirname, '../src/components')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
module: {
|
2017-03-10 11:11:49 +01:00
|
|
|
noParse: /node_modules\/localforage\/dist\/localforage.js/,
|
2019-04-07 19:33:11 +02:00
|
|
|
rules: [
|
2016-10-26 16:46:32 +02:00
|
|
|
{
|
2019-04-07 19:33:11 +02:00
|
|
|
enforce: 'pre',
|
|
|
|
test: /\.(js|vue)$/,
|
2016-10-26 16:46:32 +02:00
|
|
|
include: projectRoot,
|
2019-04-07 19:33:11 +02:00
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'eslint-loader',
|
|
|
|
options: {
|
|
|
|
formatter: require('eslint-friendly-formatter'),
|
|
|
|
sourceMap: config.build.productionSourceMap,
|
|
|
|
extract: true
|
|
|
|
}
|
|
|
|
}
|
2016-10-26 16:46:32 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
2019-04-07 19:33:11 +02:00
|
|
|
use: 'vue-loader'
|
2016-10-26 16:46:32 +02:00
|
|
|
},
|
|
|
|
{
|
2018-08-27 20:25:00 +02:00
|
|
|
test: /\.jsx?$/,
|
2016-10-26 16:46:32 +02:00
|
|
|
include: projectRoot,
|
2019-04-07 19:33:11 +02:00
|
|
|
exclude: /node_modules\/(?!tributejs)/,
|
|
|
|
use: 'babel-loader'
|
2016-10-26 16:46:32 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
2019-04-07 19:33:11 +02:00
|
|
|
use: {
|
|
|
|
loader: 'url-loader',
|
|
|
|
options: {
|
|
|
|
limit: 10000,
|
|
|
|
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
|
|
|
}
|
2016-10-26 16:46:32 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
2019-04-07 19:33:11 +02:00
|
|
|
use: {
|
|
|
|
loader: 'url-loader',
|
|
|
|
options: {
|
|
|
|
limit: 10000,
|
|
|
|
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
|
|
|
}
|
2016-10-26 16:46:32 +02:00
|
|
|
}
|
2019-04-07 19:33:11 +02:00
|
|
|
},
|
2016-10-26 16:46:32 +02:00
|
|
|
]
|
2018-12-12 18:03:50 +01:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new ServiceWorkerWebpackPlugin({
|
2019-01-28 17:52:01 +01:00
|
|
|
entry: path.join(__dirname, '..', 'src/sw.js'),
|
|
|
|
filename: 'sw-pleroma.js'
|
2019-12-03 16:32:46 +01:00
|
|
|
}),
|
|
|
|
new FontelloPlugin({
|
|
|
|
config: require('../static/fontello.json'),
|
|
|
|
name: 'fontello',
|
|
|
|
output: {
|
2019-12-05 14:46:05 +01:00
|
|
|
css: 'static/[name].' + now + '.css', // [hash] is not supported. Use the current timestamp instead for versioning.
|
|
|
|
font: 'static/font/[name].' + now + '.[ext]'
|
2019-12-03 16:32:46 +01:00
|
|
|
}
|
2018-12-12 18:03:50 +01:00
|
|
|
})
|
|
|
|
]
|
2016-10-26 16:46:32 +02:00
|
|
|
}
|