2016-10-26 07:46:32 -07:00
|
|
|
var path = require('path')
|
|
|
|
var config = require('../config')
|
|
|
|
var utils = require('./utils')
|
|
|
|
var projectRoot = path.resolve(__dirname, '../')
|
2022-08-15 15:01:33 -07:00
|
|
|
var ServiceWorkerWebpackPlugin = require('serviceworker-webpack5-plugin')
|
2021-04-11 13:03:03 -07:00
|
|
|
var CopyPlugin = require('copy-webpack-plugin');
|
2022-03-16 13:02:44 -07:00
|
|
|
var { VueLoaderPlugin } = require('vue-loader')
|
2022-07-31 02:15:44 -07:00
|
|
|
var ESLintPlugin = require('eslint-webpack-plugin');
|
|
|
|
|
2016-10-26 07:46:32 -07: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 07:32:46 -08:00
|
|
|
var now = Date.now()
|
|
|
|
|
2016-10-26 07:46:32 -07: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 12:03:03 -07:00
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
chunks: 'all'
|
|
|
|
}
|
|
|
|
},
|
2016-10-26 07:46:32 -07:00
|
|
|
resolve: {
|
2022-07-22 09:12:54 -07:00
|
|
|
extensions: ['.mjs', '.js', '.jsx', '.vue'],
|
2019-04-07 10:33:11 -07:00
|
|
|
modules: [
|
|
|
|
path.join(__dirname, '../node_modules')
|
|
|
|
],
|
2016-10-26 07:46:32 -07:00
|
|
|
alias: {
|
2020-01-26 18:20:13 -08:00
|
|
|
'static': path.resolve(__dirname, '../static'),
|
2016-10-26 07:46:32 -07:00
|
|
|
'src': path.resolve(__dirname, '../src'),
|
|
|
|
'assets': path.resolve(__dirname, '../src/assets'),
|
2022-04-06 01:30:42 -07:00
|
|
|
'components': path.resolve(__dirname, '../src/components'),
|
|
|
|
'vue-i18n': 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'
|
2022-08-15 15:01:33 -07:00
|
|
|
},
|
|
|
|
fallback: {
|
|
|
|
'querystring': require.resolve('querystring-es3'),
|
|
|
|
'url': require.resolve('url/')
|
2016-10-26 07:46:32 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
module: {
|
2017-03-10 02:11:49 -08:00
|
|
|
noParse: /node_modules\/localforage\/dist\/localforage.js/,
|
2019-04-07 10:33:11 -07:00
|
|
|
rules: [
|
2022-04-06 05:45:44 -07: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')
|
|
|
|
]
|
|
|
|
},
|
2016-10-26 07:46:32 -07:00
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
2022-03-16 13:02:44 -07:00
|
|
|
loader: 'vue-loader',
|
|
|
|
options: {
|
|
|
|
compilerOptions: {
|
2022-03-29 09:55:30 -07:00
|
|
|
isCustomElement(tag) {
|
|
|
|
if (tag === 'pinch-zoom') {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
2022-03-16 13:02:44 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-26 07:46:32 -07:00
|
|
|
},
|
|
|
|
{
|
2018-08-27 11:25:00 -07:00
|
|
|
test: /\.jsx?$/,
|
2016-10-26 07:46:32 -07:00
|
|
|
include: projectRoot,
|
2019-04-07 10:33:11 -07:00
|
|
|
exclude: /node_modules\/(?!tributejs)/,
|
|
|
|
use: 'babel-loader'
|
2016-10-26 07:46:32 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
2022-08-15 15:23:41 -07:00
|
|
|
type: 'asset',
|
|
|
|
generator: {
|
2022-08-15 15:42:21 -07:00
|
|
|
filename: utils.assetsPath('img/[name].[hash:7][ext]')
|
2016-10-26 07:46:32 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
2022-08-15 15:23:41 -07:00
|
|
|
type: 'asset',
|
|
|
|
generator: {
|
2022-08-15 15:42:21 -07:00
|
|
|
filename: utils.assetsPath('fonts/[name].[hash:7][ext]')
|
2016-10-26 07:46:32 -07:00
|
|
|
}
|
2019-04-07 10:33:11 -07:00
|
|
|
},
|
2022-07-22 09:12:54 -07:00
|
|
|
{
|
|
|
|
test: /\.mjs$/,
|
|
|
|
include: /node_modules/,
|
|
|
|
type: 'javascript/auto'
|
|
|
|
}
|
2016-10-26 07:46:32 -07:00
|
|
|
]
|
2018-12-12 09:03:50 -08:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new ServiceWorkerWebpackPlugin({
|
2019-01-28 08:52:01 -08:00
|
|
|
entry: path.join(__dirname, '..', 'src/sw.js'),
|
|
|
|
filename: 'sw-pleroma.js'
|
2021-04-24 07:56:00 -07:00
|
|
|
}),
|
2022-07-31 02:15:44 -07:00
|
|
|
new ESLintPlugin({
|
|
|
|
extensions: ['js', 'vue'],
|
|
|
|
formatter: require('eslint-formatter-friendly')
|
|
|
|
}),
|
2022-03-16 12:00:20 -07:00
|
|
|
new VueLoaderPlugin(),
|
2021-04-11 13:03:03 -07:00
|
|
|
// This copies Ruffle's WASM to a directory so that JS side can access it
|
|
|
|
new CopyPlugin({
|
|
|
|
patterns: [
|
|
|
|
{
|
2022-08-15 15:38:34 -07:00
|
|
|
from: "node_modules/@ruffle-rs/ruffle/**/*",
|
|
|
|
to: "static/ruffle/[name][ext]"
|
2021-04-11 13:03:03 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
options: {
|
|
|
|
concurrency: 100,
|
|
|
|
},
|
2018-12-12 09:03:50 -08:00
|
|
|
})
|
|
|
|
]
|
2016-10-26 07:46:32 -07:00
|
|
|
}
|