tabby/app/webpack.config.js

83 lines
2.4 KiB
JavaScript
Raw Normal View History

2017-04-12 18:12:57 +08:00
const path = require('path')
const webpack = require('webpack')
module.exports = {
name: 'terminus',
target: 'node',
entry: {
2019-05-25 03:19:08 +08:00
'index.ignore': 'file-loader?name=index.html!pug-html-loader!' + path.resolve(__dirname, './index.pug'),
preload: path.resolve(__dirname, 'src/entry.preload.ts'),
bundle: path.resolve(__dirname, 'src/entry.ts'),
2017-04-12 18:12:57 +08:00
},
2019-02-10 05:10:42 +08:00
mode: process.env.TERMINUS_DEV ? 'development' : 'production',
2018-10-12 06:17:02 +08:00
optimization:{
minimize: false,
},
2017-04-12 18:12:57 +08:00
context: __dirname,
2019-04-28 17:42:34 +08:00
devtool: 'eval-source-map',
2017-04-12 18:12:57 +08:00
output: {
2017-04-24 06:34:07 +08:00
path: path.join(__dirname, 'dist'),
2017-04-12 18:12:57 +08:00
pathinfo: true,
filename: '[name].js',
2017-04-12 18:12:57 +08:00
},
resolve: {
modules: ['src/', 'node_modules', '../node_modules', 'assets/'].map(x => path.join(__dirname, x)),
extensions: ['.ts', '.js'],
},
module: {
2018-05-20 22:12:05 +08:00
rules: [
2017-04-12 18:12:57 +08:00
{
test: /\.ts$/,
2018-05-20 22:12:05 +08:00
use: {
loader: 'awesome-typescript-loader',
options: {
configFileName: path.resolve(__dirname, 'tsconfig.json'),
},
},
2017-04-12 18:12:57 +08:00
},
2017-04-24 06:43:58 +08:00
{ test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
{ test: /\.css$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
2017-04-12 18:12:57 +08:00
{
test: /\.(png|svg)$/,
2018-05-20 22:12:05 +08:00
use: {
loader: 'file-loader',
options: {
name: 'images/[name].[ext]',
},
},
2017-04-12 18:12:57 +08:00
},
{
test: /\.(ttf|eot|otf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
2018-05-20 22:12:05 +08:00
use: {
loader: 'file-loader',
options: {
name: 'fonts/[name].[ext]',
},
},
},
],
2017-04-12 18:12:57 +08:00
},
externals: {
'@angular/core': 'commonjs @angular/core',
'@angular/compiler': 'commonjs @angular/compiler',
'@angular/platform-browser': 'commonjs @angular/platform-browser',
'@angular/platform-browser-dynamic': 'commonjs @angular/platform-browser-dynamic',
'@angular/forms': 'commonjs @angular/forms',
'@angular/common': 'commonjs @angular/common',
'@ng-bootstrap/ng-bootstrap': 'commonjs @ng-bootstrap/ng-bootstrap',
child_process: 'commonjs child_process',
electron: 'commonjs electron',
2017-05-01 19:35:26 +08:00
'electron-is-dev': 'commonjs electron-is-dev',
fs: 'commonjs fs',
2018-01-19 22:31:28 +08:00
'ngx-toastr': 'commonjs ngx-toastr',
module: 'commonjs module',
mz: 'commonjs mz',
path: 'commonjs path',
rxjs: 'commonjs rxjs',
2017-07-01 06:55:21 +08:00
'zone.js': 'commonjs zone.js/dist/zone.js',
2017-06-21 05:28:58 +08:00
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
],
2017-04-12 18:12:57 +08:00
}