2016-10-26 14:46:32 +00:00
|
|
|
var path = require('path')
|
|
|
|
var config = require('../config')
|
|
|
|
var utils = require('./utils')
|
|
|
|
var projectRoot = path.resolve(__dirname, '../')
|
2022-11-15 15:47:32 +00:00
|
|
|
const WorkboxPlugin = require('workbox-webpack-plugin');
|
2022-03-16 20:02:44 +00:00
|
|
|
var { VueLoaderPlugin } = require('vue-loader')
|
2016-10-26 14:46:32 +00: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 15:32:46 +00:00
|
|
|
var now = Date.now()
|
|
|
|
|
2016-10-26 14:46:32 +00:00
|
|
|
module.exports = {
|
|
|
|
entry: {
|
|
|
|
app: './src/main.js'
|
|
|
|
},
|
|
|
|
output: {
|
2022-11-15 15:47:32 +00:00
|
|
|
hashFunction: "sha256", // Workaround for builds with OpenSSL 3.
|
2016-10-26 14:46:32 +00:00
|
|
|
path: config.build.assetsRoot,
|
|
|
|
publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
|
|
|
|
filename: '[name].js'
|
|
|
|
},
|
2019-04-28 19:03:03 +00:00
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
chunks: 'all'
|
|
|
|
}
|
|
|
|
},
|
2016-10-26 14:46:32 +00:00
|
|
|
resolve: {
|
2022-08-01 12:07:39 +00:00
|
|
|
extensions: ['.js', '.jsx', '.vue', '.mjs'],
|
2019-04-07 17:33:11 +00:00
|
|
|
modules: [
|
|
|
|
path.join(__dirname, '../node_modules')
|
|
|
|
],
|
2022-11-15 15:47:32 +00:00
|
|
|
fallback: {
|
|
|
|
"url": require.resolve("url/"),
|
|
|
|
},
|
2016-10-26 14:46:32 +00:00
|
|
|
alias: {
|
2020-01-27 02:20:13 +00:00
|
|
|
'static': path.resolve(__dirname, '../static'),
|
2016-10-26 14:46:32 +00:00
|
|
|
'src': path.resolve(__dirname, '../src'),
|
|
|
|
'assets': path.resolve(__dirname, '../src/assets'),
|
2022-04-06 08:30:42 +00:00
|
|
|
'components': path.resolve(__dirname, '../src/components'),
|
|
|
|
'vue-i18n': 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'
|
2016-10-26 14:46:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
module: {
|
2017-03-10 10:11:49 +00:00
|
|
|
noParse: /node_modules\/localforage\/dist\/localforage.js/,
|
2019-04-07 17:33:11 +00:00
|
|
|
rules: [
|
2016-10-26 14:46:32 +00:00
|
|
|
{
|
2019-04-07 17:33:11 +00:00
|
|
|
enforce: 'pre',
|
|
|
|
test: /\.(js|vue)$/,
|
2016-10-26 14:46:32 +00:00
|
|
|
include: projectRoot,
|
2019-04-07 17:33:11 +00:00
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'eslint-loader',
|
|
|
|
options: {
|
|
|
|
formatter: require('eslint-friendly-formatter'),
|
|
|
|
sourceMap: config.build.productionSourceMap,
|
|
|
|
extract: true
|
|
|
|
}
|
|
|
|
}
|
2016-10-26 14:46:32 +00:00
|
|
|
},
|
2022-04-06 12:45:44 +00:00
|
|
|
{
|
|
|
|
enforce: 'post',
|
|
|
|
test: /\.(json5?|ya?ml)$/, // target json, json5, yaml and yml files
|
|
|
|
type: 'javascript/auto',
|
|
|
|
loader: '@intlify/vue-i18n-loader',
|
|
|
|
include: [ // Use `Rule.include` to specify the files of locale messages to be pre-compiled
|
|
|
|
path.resolve(__dirname, '../src/i18n')
|
|
|
|
]
|
|
|
|
},
|
2022-08-01 12:07:39 +00:00
|
|
|
{
|
|
|
|
test: /\.mjs$/,
|
|
|
|
include: /node_modules/,
|
|
|
|
type: "javascript/auto"
|
|
|
|
},
|
2016-10-26 14:46:32 +00:00
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
2022-03-16 20:02:44 +00:00
|
|
|
loader: 'vue-loader',
|
|
|
|
options: {
|
|
|
|
compilerOptions: {
|
2022-03-29 16:55:30 +00:00
|
|
|
isCustomElement(tag) {
|
|
|
|
if (tag === 'pinch-zoom') {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
2022-03-16 20:02:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-26 14:46:32 +00:00
|
|
|
},
|
|
|
|
{
|
2018-08-27 18:25:00 +00:00
|
|
|
test: /\.jsx?$/,
|
2016-10-26 14:46:32 +00:00
|
|
|
include: projectRoot,
|
2019-04-07 17:33:11 +00:00
|
|
|
exclude: /node_modules\/(?!tributejs)/,
|
|
|
|
use: 'babel-loader'
|
2016-10-26 14:46:32 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
2019-04-07 17:33:11 +00:00
|
|
|
use: {
|
|
|
|
loader: 'url-loader',
|
|
|
|
options: {
|
|
|
|
limit: 10000,
|
|
|
|
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
|
|
|
}
|
2016-10-26 14:46:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
2019-04-07 17:33:11 +00:00
|
|
|
use: {
|
|
|
|
loader: 'url-loader',
|
|
|
|
options: {
|
|
|
|
limit: 10000,
|
|
|
|
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
|
|
|
}
|
2016-10-26 14:46:32 +00:00
|
|
|
}
|
2019-04-07 17:33:11 +00:00
|
|
|
},
|
2016-10-26 14:46:32 +00:00
|
|
|
]
|
2018-12-12 17:03:50 +00:00
|
|
|
},
|
|
|
|
plugins: [
|
2022-11-15 15:47:32 +00:00
|
|
|
new WorkboxPlugin.InjectManifest({
|
|
|
|
swSrc: path.join(__dirname, '..', 'src/sw.js'),
|
|
|
|
swDest: 'sw-pleroma.js',
|
|
|
|
maximumFileSizeToCacheInBytes: 15 * 1024 * 1024,
|
2021-04-24 14:56:00 +00:00
|
|
|
}),
|
2022-11-15 15:47:32 +00:00
|
|
|
new VueLoaderPlugin()
|
2018-12-12 17:03:50 +00:00
|
|
|
]
|
2016-10-26 14:46:32 +00:00
|
|
|
}
|