This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/webpack.config.js

120 lines
3.4 KiB
JavaScript
Raw Permalink Normal View History

2017-05-12 00:23:56 +00:00
/* eslint-disable */
2016-09-15 03:50:59 +00:00
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { RelativeCiAgentWebpackPlugin } = require('@relative-ci/agent');
const pkg = require("rich-markdown-editor/package.json");
2021-02-15 23:19:51 +00:00
const WebpackPwaManifest = require("webpack-pwa-manifest");
const WorkboxPlugin = require("workbox-webpack-plugin");
2016-02-27 21:53:11 +00:00
2017-02-10 05:55:36 +00:00
require('dotenv').config({ silent: true });
2016-02-27 21:53:11 +00:00
module.exports = {
output: {
path: path.join(__dirname, 'build/app'),
filename: '[name].[hash].js',
2016-09-15 03:50:59 +00:00
publicPath: '/static/',
2016-02-27 21:53:11 +00:00
},
module: {
2018-01-04 00:29:01 +00:00
rules: [
2016-02-27 21:53:11 +00:00
{
test: /\.js$/,
loader: 'babel-loader',
exclude: [
path.join(__dirname, 'node_modules')
],
include: [
path.join(__dirname, 'app'),
path.join(__dirname, 'shared'),
],
options: {
cacheDirectory: true
}
2016-02-27 21:53:11 +00:00
},
2016-09-15 03:50:59 +00:00
// inline base64 URLs for <=8k images, direct URLs for the rest
{ test: /\.(png|jpg|svg)$/, loader: 'url-loader' },
{
test: /\.woff$/,
loader: 'url-loader?limit=1&mimetype=application/font-woff&name=public/fonts/[name].[ext]',
},
2017-05-12 00:23:56 +00:00
{ test: /\.md/, loader: 'raw-loader' },
2018-11-10 07:40:33 +00:00
]
2016-02-27 21:53:11 +00:00
},
resolve: {
2018-01-04 00:29:01 +00:00
modules: [
2018-01-04 05:35:13 +00:00
path.resolve(__dirname, 'app'),
2018-01-04 00:29:01 +00:00
'node_modules'
],
alias: {
2018-01-04 05:35:13 +00:00
shared: path.resolve(__dirname, 'shared'),
'boundless-arrow-key-navigation': 'boundless-arrow-key-navigation/build',
'boundless-popover': 'boundless-popover/build',
'boundless-utils-omit-keys': 'boundless-utils-omit-keys/build',
'boundless-utils-uuid': 'boundless-utils-uuid/build'
2018-01-04 00:29:01 +00:00
}
2016-02-27 21:53:11 +00:00
},
plugins: [
new webpack.DefinePlugin({
EDITOR_VERSION: JSON.stringify(pkg.version)
}),
2017-07-11 04:47:02 +00:00
new webpack.IgnorePlugin(/unicode\/category\/So/),
new HtmlWebpackPlugin({
template: 'server/static/index.html',
}),
2021-02-15 23:19:51 +00:00
new WebpackPwaManifest({
name: "Outline",
short_name: "Outline",
background_color: "#fff",
theme_color: "#fff",
start_url: "/",
publicPath: "/static/",
2021-02-15 23:19:51 +00:00
display: "standalone",
icons: [
{
src: path.resolve("public/icon-512.png"),
// For Chrome, you must provide at least a 192x192 pixel icon, and a 512x512 pixel icon.
// If only those two icon sizes are provided, Chrome will automatically scale the icons
// to fit the device. If you'd prefer to scale your own icons, and adjust them for
// pixel-perfection, provide icons in increments of 48dp.
sizes: [512, 192],
purpose: "any maskable",
},
]
}),
new WorkboxPlugin.GenerateSW({
clientsClaim: true,
skipWaiting: true,
maximumFileSizeToCacheInBytes: 15 * 1024 * 1024, // For large bundles
}),
new RelativeCiAgentWebpackPlugin(),
2016-06-05 01:28:14 +00:00
],
stats: {
assets: false,
},
optimization: {
runtimeChunk: 'single',
moduleIds: 'hashed',
chunkIds: 'named',
splitChunks: {
chunks: 'async',
minSize: 20000,
minChunks: 1,
maxAsyncRequests: 30,
maxInitialRequests: 30,
enforceSizeThreshold: 50000,
cacheGroups: {
defaultVendors: {
test: /[\\/]node_modules[\\/]/,
priority: -10,
reuseExistingChunk: true,
},
default: {
minChunks: 2,
priority: -20,
reuseExistingChunk: true,
}
}
}
}
2016-07-24 22:32:31 +00:00
};