Files
replayweb.page/webpack.config.js
T
Ilya Kreymer 228e9bdff6 IPFS Support + Loading Improvements (Better local file handling) + Streamlined Collection View (#25)
* support ipfs:// urls!
misc: better error message for loading from http://
tabs: don't render pages/story/urls if hidden

* ipfs work: remove ww only use sw

* electron + ipfs: add ipfs support to electron app, using ipfs-core
- route ipfs requests to files proxy with 'ipfs=' query param

* file loading:
- add support for new Chrome native file system api with file handles, which allows persistent access to files vial file handles
- if window.showOpenFilePicker() is available use that, include file handle in load message
- support asking permissions for file handles, using similar workflow as google drive auth
- attempt to ask for file permission directly, show auth button if fails (user gestured required)
- replace auth modal with iframe replacement insert to ask for auth for google drive and local file

* ui overhaul for 1.3.0 / condense collection view:
- don't show navbar in collection view
- add logo to back to home page to location bar
- condense location bar buttons
- convert terms to general about dialog, available from collection context menu
- add info tab to collection view in place of drop-down info
- make <wr-coll-info> component, used in both collection list and info tab with additional details
- update to wabac.js 2.2.0

* update CHANGES.md
2020-11-16 18:31:15 -08:00

146 lines
3.6 KiB
JavaScript

const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyPlugin = require('copy-webpack-plugin');
// fake url used in app to serve files
// can not use custom scheme due to service worker issues
const APP_FILE_SERVE_PREFIX = "http://files.replayweb.page/";
//const APP_FILE_SERVE_PREFIX = "file://files.replayweb.page";
// helper proxy URL, run locally for app
const HELPER_PROXY = "https://helper-proxy.webrecorder.workers.dev";
// GDrive client-id
const GDRIVE_CLIENT_ID = "160798412227-tko4c82uopud11q105b2lvbogsj77hlg.apps.googleusercontent.com";
// Copyright banner text
const BANNER_TEXT = "'[name].js is part of ReplayWeb.page (https://replayweb.page) Copyright (C) 2020, Webrecorder Software. Licensed under the Affero General Public License v3.'";
const electronMainConfig = (env, argv) => {
return {
target: 'electron-main',
mode: 'production',
entry: {
'electron': './src/electron-main.js',
},
resolve: {
alias: {
"abort-controller": "abort-controller/dist/abort-controller.js",
"dlv": "dlv/dist/dlv.js",
"bignumber.js": "bignumber.js/bignumber.js"
}
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js',
},
node: {
__dirname: false,
__filename: false,
},
plugins: [
new webpack.DefinePlugin({
__APP_FILE_SERVE_PREFIX__ : JSON.stringify(APP_FILE_SERVE_PREFIX),
__HELPER_PROXY__ : JSON.stringify(HELPER_PROXY)
}),
new webpack.BannerPlugin(BANNER_TEXT),
new CopyPlugin({
patterns: [
{ from: 'node_modules/bcrypto/build/Release/bcrypto.node', to: 'build' },
{ from: 'node_modules/leveldown/prebuilds/', to: 'prebuilds' },
],
}),
],
externals: {
"bufferutil": "bufferutil",
"utf-8-validate": "utf-8-validate",
}
}
};
const electronPreloadConfig = (env, argv) => {
return {
target: 'electron-preload',
mode: 'production',
entry: {
'preload': './src/electron-preload.js',
},
plugins: [
new webpack.BannerPlugin(BANNER_TEXT)
],
}
};
const browserConfig = (env, argv) => {
return {
target: 'web',
mode: 'production',
entry: {
'ui': './src/ui.js',
'sw': './src/sw.js'
},
output: {
path: path.join(__dirname),
filename: '[name].js',
libraryTarget: 'self',
globalObject: 'self',
publicPath: '/'
},
externals: {
electron: 'electron',
},
devServer: {
compress: true,
port: 9990,
open: false,
contentBase: path.join(__dirname),
publicPath: '/'
},
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
new MiniCssExtractPlugin(),
new webpack.DefinePlugin({
__SW_NAME__: JSON.stringify('sw.js'),
__APP_FILE_SERVE_PREFIX__ : JSON.stringify(APP_FILE_SERVE_PREFIX),
__HELPER_PROXY__ : JSON.stringify(HELPER_PROXY),
__GDRIVE_CLIENT_ID__ : JSON.stringify(GDRIVE_CLIENT_ID),
__VERSION__: JSON.stringify(require("./package.json").version)
}),
new webpack.BannerPlugin(BANNER_TEXT)
],
module: {
rules: [
{
test: /\.svg$/,
use: ['svg-inline-loader'],
},
{
test: /main.scss$/,
use: ['css-loader', 'sass-loader']
},
{
test: /wombat.js|wombatWorkers.js|index.html$/i,
use: ['raw-loader'],
}
]
},
}
};
module.exports = [ browserConfig, electronMainConfig, electronPreloadConfig ];