hyper/webpack.config.ts

151 lines
3.3 KiB
TypeScript
Raw Normal View History

const path = require('path');
2016-06-30 22:01:04 -08:00
const webpack = require('webpack');
2016-07-28 01:28:04 -08:00
const Copy = require('copy-webpack-plugin');
2020-01-20 12:23:21 -09:00
const TerserPlugin = require('terser-webpack-plugin');
2016-06-30 22:01:04 -08:00
const nodeEnv = process.env.NODE_ENV || 'development';
const isProd = nodeEnv === 'production';
module.exports = [
{
mode: 'none',
name: 'hyper-app',
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json']
},
entry: './app/index.ts',
output: {
path: path.join(__dirname, 'target'),
filename: 'ignore_this.js'
},
module: {
rules: [
{
test: /\.(js|jsx|ts|tsx)$/,
exclude: /node_modules/,
loader: 'null-loader'
}
]
},
plugins: [
new Copy([
{
from: './app/*.html',
exclude: /node_modules/,
to: '.',
flatten: true
},
{
from: './app/*.json',
exclude: /node_modules/,
to: '.',
flatten: true
},
{
from: './app/keymaps/*.json',
exclude: /node_modules/,
to: './keymaps',
flatten: true
Update Electron to v6 (#3785) * 3.0.0 * 3.0.2 * Save * Save * Upgrade yarn lock packages * update node-gyp and node-pty * update travis and appveyor to node 12 * appveyor is outdated as always * update travis to xenial * update node-pty@0.9.0-beta26 * update yarn.lock * update electron to 6.0.8 * move node-pty to the correct package.json * Fix linting failure * Update yarn lockfile to try to fix appveyor build * Remove unnecessary changes from package.json * Try to fix appveyor by using a newer image * Fix linting after my last change * update electron to 6.0.9 * install windows-build-tools on appveyor * fix syntax * switch back to 2017 image * remove old resolutions field * revert accidental version change * update electron to 6.0.11 and electron-rebuild to 1.8.6 * downgrade yarn to 1.18 until this issue is resolved https://github.com/yarnpkg/yarn/issues/7584 * update node-gyp to 6.0.0 and generate a fresh yarn lockfile * update react and a few other dependencies * fix lint * this should actually be electron-builder, I think! * update a few dependencies * change to electron-store electron-config was renamed to electron-store a while ago * update xterm to v4.1.0 and ora to 4.0.2 * move pify to app/package.json * TODO: Revert maybe. Throw a fit on every change to maybe fix the resizing issues * a * fix react ref problem * fix split view focus problem * remove the unnecessary fit * remove the init col and row * fix the problem that cannot show about hyper * update electron to 6.0.12 * fix lint * add more todos for componentWillReceiveProps deprecation * update babel and plugins Co-authored-by: Juan Campa <juancampa@gmail.com> Co-authored-by: Benjamin Staneck <staneck@gmail.com> Co-authored-by: ivan <ivanwonder@outlook.com>
2019-10-10 11:20:26 -08:00
},
{
from: './app/static',
to: './static'
}
2019-10-01 00:57:37 -08:00
])
],
target: 'electron-main'
},
{
2019-09-04 22:49:56 -08:00
mode: 'none',
name: 'hyper',
resolve: {
2019-09-08 10:41:06 -08:00
extensions: ['.js', '.jsx', '.ts', '.tsx']
},
devtool: isProd ? 'hidden-source-map' : 'cheap-module-source-map',
entry: './lib/index.tsx',
output: {
path: path.join(__dirname, 'target', 'renderer'),
filename: 'bundle.js'
},
module: {
rules: [
{
2019-09-08 10:41:06 -08:00
test: /\.(js|jsx|ts|tsx)$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.json/,
loader: 'json-loader'
},
// for xterm.js
{
test: /\.css$/,
loader: 'style-loader!css-loader'
}
]
},
plugins: [
new webpack.IgnorePlugin(/.*\.js.map$/i),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(nodeEnv)
}
}),
new Copy([
{
from: './assets',
to: './assets'
}
])
],
2020-01-20 12:23:21 -09:00
optimization: {
2020-01-21 10:48:59 -09:00
minimize: isProd ? true : false,
2020-01-20 12:23:21 -09:00
minimizer: [new TerserPlugin()]
},
2019-09-04 22:49:56 -08:00
target: 'electron-renderer'
},
{
2019-09-04 22:49:56 -08:00
mode: 'none',
name: 'hyper-cli',
resolve: {
2019-12-14 02:29:48 -09:00
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json']
},
devtool: isProd ? 'none' : 'cheap-module-source-map',
2019-12-14 02:29:48 -09:00
entry: './cli/index.ts',
output: {
path: path.join(__dirname, 'bin'),
filename: 'cli.js'
},
module: {
rules: [
{
2019-12-14 02:29:48 -09:00
test: /\.(js|jsx|ts|tsx)$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /index.js/,
loader: 'shebang-loader',
include: [/node_modules\/rc/]
}
]
},
plugins: [
// spawn-sync is required by execa if node <= 0.10
new webpack.IgnorePlugin(/(.*\.js.map|spawn-sync)$/i),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(nodeEnv)
})
],
2020-01-20 12:23:21 -09:00
optimization: {
2020-01-21 10:48:59 -09:00
minimize: isProd ? true : false,
2020-01-20 12:23:21 -09:00
minimizer: [new TerserPlugin()]
},
target: 'node'
}
];