mirror of https://github.com/Ombi-app/Ombi
Various improvements to webpack/gulp/vscode support (#1617)
* Various improvements to webpack/gulp/vscode support * Improve vendor webpack config - hopefully fix const/let appearingpull/1627/head
parent
71aa0750d6
commit
d59be43ca1
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"Angular.ng-template",
|
||||||
|
"ms-vscode.csharp"
|
||||||
|
]
|
||||||
|
}
|
@ -1,5 +1,13 @@
|
|||||||
{
|
{
|
||||||
|
"files.exclude": {
|
||||||
|
"**/*.js": {"when": "$(basename).ts"},
|
||||||
|
"**/*.js.map": true,
|
||||||
|
"node_modules": true,
|
||||||
|
"obj": true,
|
||||||
|
"bin": true
|
||||||
|
},
|
||||||
|
"typescript.tsdk": "node_modules\\typescript\\lib",
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"usermanagement"
|
"usermanagement"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,42 @@
|
|||||||
{
|
{
|
||||||
"version": "0.1.0",
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
"command": "dotnet",
|
// for the documentation about the tasks.json format
|
||||||
"isShellCommand": true,
|
"version": "2.0.0",
|
||||||
"args": [],
|
|
||||||
"tasks": [
|
"tasks": [
|
||||||
|
{
|
||||||
|
"taskName": "restore",
|
||||||
|
"command": "npm",
|
||||||
|
"type": "shell",
|
||||||
|
"args": [
|
||||||
|
"run-script",
|
||||||
|
"restore"
|
||||||
|
],
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"taskName": "build",
|
"taskName": "build",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "shell",
|
||||||
|
"args": [
|
||||||
|
"build"
|
||||||
|
],
|
||||||
|
"group": {
|
||||||
|
"isDefault": true,
|
||||||
|
"kind": "build"
|
||||||
|
},
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"taskName": "lint",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "npm",
|
||||||
"args": [
|
"args": [
|
||||||
"${workspaceRoot}/Ombi.csproj"
|
"run",
|
||||||
|
"lint",
|
||||||
|
"--",
|
||||||
|
"--format",
|
||||||
|
"msbuild"
|
||||||
],
|
],
|
||||||
"isBuildCommand": true,
|
|
||||||
"problemMatcher": "$msCompile"
|
"problemMatcher": "$msCompile"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,2 +1 @@
|
|||||||
/// <reference path="globals/globals.d.ts" />
|
/// <reference path="globals/globals.d.ts" />
|
||||||
/// <reference path="../node_modules/@types/intro.js/index.d.ts" />
|
|
@ -1,59 +0,0 @@
|
|||||||
const path = require('path');
|
|
||||||
const webpack = require('webpack');
|
|
||||||
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
|
|
||||||
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
||||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
||||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
|
||||||
|
|
||||||
module.exports = function (env) {
|
|
||||||
const extractCSS = new ExtractTextPlugin('main.css');
|
|
||||||
const prod = env && env.prod;
|
|
||||||
console.log(prod ? 'Production' : 'Dev' + ' main build');
|
|
||||||
const analyse = env && env.analyse;
|
|
||||||
if (analyse) { console.log("Analysing build"); }
|
|
||||||
const cssLoader = prod ? 'css-loader?minimize' : 'css-loader';
|
|
||||||
const outputDir = './wwwroot/dist';
|
|
||||||
const bundleConfig = {
|
|
||||||
entry: { 'main': './ClientApp/main.ts' },
|
|
||||||
stats: { modules: false },
|
|
||||||
context: __dirname,
|
|
||||||
resolve: { extensions: ['.ts', '.js'] },
|
|
||||||
devtool: prod ? 'source-map' : 'eval-source-map',
|
|
||||||
output: {
|
|
||||||
filename: '[name].js',
|
|
||||||
publicPath: '/dist/',
|
|
||||||
path: path.join(__dirname, outputDir)
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{ test: /\.ts$/, include: /ClientApp/, use: ['awesome-typescript-loader?silent=true', 'angular2-template-loader'] },
|
|
||||||
{ test: /\.html$/, use: 'html-loader?minimize=false' },
|
|
||||||
{ test: /\.css$/, use: ['to-string-loader', cssLoader] },
|
|
||||||
{ test: /\.scss$/, include: /ClientApp(\\|\/)app/, use: ["to-string-loader", cssLoader, "sass-loader"] },
|
|
||||||
{ test: /\.scss$/, include: /ClientApp(\\|\/)styles/, use: ["style-loader", cssLoader, "sass-loader"] },
|
|
||||||
{ test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new CheckerPlugin(),
|
|
||||||
extractCSS,
|
|
||||||
new webpack.DllReferencePlugin({
|
|
||||||
context: __dirname,
|
|
||||||
manifest: require(path.join(__dirname, outputDir, 'vendor-manifest.json'))
|
|
||||||
})
|
|
||||||
].concat(prod ? [
|
|
||||||
// Plugins that apply in production builds only
|
|
||||||
new UglifyJSPlugin()
|
|
||||||
] : [
|
|
||||||
// Plugins that apply in development builds only
|
|
||||||
]).concat(analyse ? [
|
|
||||||
new BundleAnalyzerPlugin({
|
|
||||||
analyzerMode: 'static',
|
|
||||||
reportFilename: 'main.html',
|
|
||||||
openAnalyzer: false
|
|
||||||
})
|
|
||||||
] : [])
|
|
||||||
};
|
|
||||||
|
|
||||||
return bundleConfig;
|
|
||||||
};
|
|
@ -0,0 +1,57 @@
|
|||||||
|
import { CheckerPlugin } from "awesome-typescript-loader";
|
||||||
|
import * as path from "path";
|
||||||
|
import * as UglifyJSPlugin from "uglifyjs-webpack-plugin";
|
||||||
|
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
|
||||||
|
|
||||||
|
import * as webpack from "webpack";
|
||||||
|
|
||||||
|
module.exports = (env: any) => {
|
||||||
|
const prod = env && env.prod as boolean;
|
||||||
|
console.log(prod ? "Production" : "Dev" + " main build");
|
||||||
|
const analyse = env && env.analyse as boolean;
|
||||||
|
if (analyse) { console.log("Analysing build"); }
|
||||||
|
const cssLoader = prod ? "css-loader?-url&minimize" : "css-loader?-url";
|
||||||
|
const outputDir = "./wwwroot/dist";
|
||||||
|
const bundleConfig: webpack.Configuration = {
|
||||||
|
entry: { main: "./ClientApp/main.ts" },
|
||||||
|
stats: { modules: false },
|
||||||
|
context: __dirname,
|
||||||
|
resolve: { extensions: [".ts", ".js"] },
|
||||||
|
devtool: prod ? "source-map" : "eval-source-map",
|
||||||
|
output: {
|
||||||
|
filename: "[name].js",
|
||||||
|
publicPath: "/dist/",
|
||||||
|
path: path.join(__dirname, outputDir),
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{ test: /\.ts$/, include: /ClientApp/, use: ["awesome-typescript-loader?silent=true", "angular2-template-loader"] },
|
||||||
|
{ test: /\.html$/, use: "html-loader?minimize=false" },
|
||||||
|
{ test: /\.css$/, use: ["to-string-loader", cssLoader] },
|
||||||
|
{ test: /\.scss$/, include: /ClientApp(\\|\/)app/, use: ["to-string-loader", cssLoader, "sass-loader"] },
|
||||||
|
{ test: /\.scss$/, include: /ClientApp(\\|\/)styles/, use: ["style-loader", cssLoader, "sass-loader"] },
|
||||||
|
{ test: /\.(png|jpg|jpeg|gif|svg)$/, use: "url-loader?limit=25000" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new CheckerPlugin(),
|
||||||
|
new webpack.DllReferencePlugin({
|
||||||
|
context: __dirname,
|
||||||
|
manifest: require(path.join(__dirname, outputDir, "vendor-manifest.json")),
|
||||||
|
}),
|
||||||
|
].concat(prod ? [
|
||||||
|
// Plugins that apply in production builds only
|
||||||
|
new UglifyJSPlugin({ sourceMap: true }),
|
||||||
|
] : [
|
||||||
|
// Plugins that apply in development builds only
|
||||||
|
]).concat(analyse ? [
|
||||||
|
new BundleAnalyzerPlugin({
|
||||||
|
analyzerMode: "static",
|
||||||
|
reportFilename: "main.html",
|
||||||
|
openAnalyzer: false,
|
||||||
|
}),
|
||||||
|
] : []),
|
||||||
|
};
|
||||||
|
|
||||||
|
return bundleConfig;
|
||||||
|
};
|
@ -1,98 +0,0 @@
|
|||||||
const path = require('path');
|
|
||||||
const webpack = require('webpack');
|
|
||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
||||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
||||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
|
||||||
|
|
||||||
module.exports = function (env) {
|
|
||||||
const extractCSS = new ExtractTextPlugin('vendor.css');
|
|
||||||
const prod = env && env.prod;
|
|
||||||
console.log(prod ? 'Production' : 'Dev' + ' vendor build');
|
|
||||||
const analyse = env && env.analyse;
|
|
||||||
if (analyse) { console.log("Analysing build") };
|
|
||||||
const outputDir = './wwwroot/dist';
|
|
||||||
const bundleConfig = {
|
|
||||||
stats: { modules: false },
|
|
||||||
resolve: { extensions: ['.js'] },
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{ test: /\.(png|woff|woff2|eot|ttf|svg|gif)(\?|$)/, use: 'url-loader?limit=100000' },
|
|
||||||
{ test: /\.css(\?|$)/, use: extractCSS.extract({ use: prod ? 'css-loader?minimize' : 'css-loader' }) },
|
|
||||||
{ test: /\.scss(\?|$)/, use: extractCSS.extract({ use: [prod ? 'css-loader?minimize' : 'css-loader', 'sass-loader'] }) }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
entry: {
|
|
||||||
vendor: [
|
|
||||||
'@angular/animations',
|
|
||||||
'@angular/common',
|
|
||||||
'@angular/compiler',
|
|
||||||
'@angular/core',
|
|
||||||
'@angular/forms',
|
|
||||||
'@angular/http',
|
|
||||||
'@angular/platform-browser',
|
|
||||||
'@angular/platform-browser-dynamic',
|
|
||||||
'@angular/router',
|
|
||||||
'@angular/material',
|
|
||||||
'primeng/resources/primeng.min.css',
|
|
||||||
'primeng/resources/themes/omega/theme.css',
|
|
||||||
'@angular/material/prebuilt-themes/deeppurple-amber.css',
|
|
||||||
'event-source-polyfill',
|
|
||||||
'jquery',
|
|
||||||
'zone.js',
|
|
||||||
'primeng/primeng',
|
|
||||||
'reflect-metadata',
|
|
||||||
'core-js',
|
|
||||||
'angular2-jwt',
|
|
||||||
'bootstrap/dist/js/bootstrap',
|
|
||||||
'font-awesome/scss/font-awesome.scss',
|
|
||||||
'pace-progress',
|
|
||||||
'pace-progress/themes/orange/pace-theme-flash.css',
|
|
||||||
'intro.js-mit/intro.js',
|
|
||||||
'intro.js-mit/introjs.css',
|
|
||||||
'ngx-clipboard',
|
|
||||||
'bootswatch/superhero/bootstrap.min.css',
|
|
||||||
'style-loader',
|
|
||||||
'ng2-cookies',
|
|
||||||
//'ng2-dragula',
|
|
||||||
//'dragula/dist/dragula.min.css'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
publicPath: '/dist/',
|
|
||||||
filename: '[name].js',
|
|
||||||
library: '[name]_[hash]',
|
|
||||||
path: path.join(__dirname, outputDir)
|
|
||||||
},
|
|
||||||
node: {
|
|
||||||
fs: "empty",
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
pace: 'pace-progress'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', Hammer: 'hammerjs/hammer' }), // Global identifiers
|
|
||||||
new webpack.ContextReplacementPlugin(/\@angular\b.*\b(bundles|linker)/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/11580
|
|
||||||
new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)@angular/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/14898
|
|
||||||
new webpack.IgnorePlugin(/^vertx$/), // Workaround for https://github.com/stefanpenner/es6-promise/issues/100
|
|
||||||
extractCSS,
|
|
||||||
new webpack.DllPlugin({
|
|
||||||
path: path.join(__dirname, outputDir, '[name]-manifest.json'),
|
|
||||||
name: '[name]_[hash]'
|
|
||||||
})
|
|
||||||
].concat(prod ? [
|
|
||||||
// Plugins that apply in production builds only
|
|
||||||
new UglifyJSPlugin()
|
|
||||||
] : [
|
|
||||||
// Plugins that apply in development builds only
|
|
||||||
]).concat(analyse ? [
|
|
||||||
new BundleAnalyzerPlugin({
|
|
||||||
analyzerMode: 'static',
|
|
||||||
reportFilename: 'vendor.html',
|
|
||||||
openAnalyzer: false
|
|
||||||
})
|
|
||||||
] : [])
|
|
||||||
};
|
|
||||||
return bundleConfig;
|
|
||||||
}
|
|
@ -0,0 +1,103 @@
|
|||||||
|
import * as ExtractTextPlugin from "extract-text-webpack-plugin";
|
||||||
|
import * as path from "path";
|
||||||
|
import * as UglifyJSPlugin from "uglifyjs-webpack-plugin";
|
||||||
|
import * as webpack from "webpack";
|
||||||
|
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
|
||||||
|
|
||||||
|
module.exports = (env: any) => {
|
||||||
|
const extractCSS = new ExtractTextPlugin("vendor.css");
|
||||||
|
const prod = env && env.prod as boolean;
|
||||||
|
console.log(prod ? "Production" : "Dev" + " vendor build");
|
||||||
|
const analyse = env && env.analyse as boolean;
|
||||||
|
if (analyse) { console.log("Analysing build"); }
|
||||||
|
const outputDir = "./wwwroot/dist";
|
||||||
|
const bundleConfig = {
|
||||||
|
stats: { modules: false },
|
||||||
|
resolve: {
|
||||||
|
extensions: [".js"],
|
||||||
|
alias: {
|
||||||
|
pace: "pace-progress",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{ test: /\.(png|woff|woff2|eot|ttf|svg|gif)(\?|$)/, use: "url-loader?limit=100000" },
|
||||||
|
{ test: /\.css(\?|$)/, use: extractCSS.extract({ use: prod ? "css-loader?minimize" : "css-loader" }) },
|
||||||
|
{ test: /\.scss(\?|$)/, use: extractCSS.extract({ use: [prod ? "css-loader?minimize" : "css-loader", "sass-loader"] }) },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
entry: {
|
||||||
|
vendor: [
|
||||||
|
"pace-progress/themes/orange/pace-theme-flash.css",
|
||||||
|
"primeng/resources/primeng.min.css",
|
||||||
|
"@angular/material/prebuilt-themes/deeppurple-amber.css",
|
||||||
|
"font-awesome/scss/font-awesome.scss",
|
||||||
|
"intro.js-mit/introjs.css",
|
||||||
|
"bootswatch/superhero/bootstrap.min.css",
|
||||||
|
|
||||||
|
"@angular/animations",
|
||||||
|
"@angular/common",
|
||||||
|
"@angular/compiler",
|
||||||
|
"@angular/core",
|
||||||
|
"@angular/forms",
|
||||||
|
"@angular/http",
|
||||||
|
"@angular/platform-browser",
|
||||||
|
"@angular/platform-browser/animations",
|
||||||
|
"@angular/platform-browser-dynamic",
|
||||||
|
"@angular/router",
|
||||||
|
"@angular/material",
|
||||||
|
"@angular/cdk",
|
||||||
|
"pace-progress",
|
||||||
|
"primeng/primeng",
|
||||||
|
"jquery",
|
||||||
|
"zone.js",
|
||||||
|
"reflect-metadata",
|
||||||
|
"core-js",
|
||||||
|
"rxjs",
|
||||||
|
"css-loader/lib/css-base",
|
||||||
|
"core-js/es6/string",
|
||||||
|
"core-js/es6/array",
|
||||||
|
"core-js/es6/object",
|
||||||
|
"core-js/es7/reflect",
|
||||||
|
"hammerjs",
|
||||||
|
"event-source-polyfill",
|
||||||
|
"bootstrap/dist/js/bootstrap",
|
||||||
|
"intro.js-mit/intro.js",
|
||||||
|
"ngx-clipboard",
|
||||||
|
"angular2-jwt",
|
||||||
|
"ng2-cookies",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
publicPath: "/dist/",
|
||||||
|
filename: "[name].js",
|
||||||
|
library: "[name]_[hash]",
|
||||||
|
path: path.join(__dirname, outputDir),
|
||||||
|
},
|
||||||
|
node: {
|
||||||
|
fs: "empty",
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", Hammer: "hammerjs/hammer" }), // Global identifiers
|
||||||
|
new webpack.ContextReplacementPlugin(/\@angular\b.*\b(bundles|linker)/, path.join(__dirname, "./ClientApp")), // Workaround for https://github.com/angular/angular/issues/11580
|
||||||
|
new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)@angular/, path.join(__dirname, "./ClientApp")), // Workaround for https://github.com/angular/angular/issues/14898
|
||||||
|
extractCSS,
|
||||||
|
new webpack.DllPlugin({
|
||||||
|
path: path.join(__dirname, outputDir, "[name]-manifest.json"),
|
||||||
|
name: "[name]_[hash]",
|
||||||
|
}),
|
||||||
|
].concat(prod ? [
|
||||||
|
// Plugins that apply in production builds only
|
||||||
|
new UglifyJSPlugin(),
|
||||||
|
] : [
|
||||||
|
// Plugins that apply in development builds only
|
||||||
|
]).concat(analyse ? [
|
||||||
|
new BundleAnalyzerPlugin({
|
||||||
|
analyzerMode: "static",
|
||||||
|
reportFilename: "vendor.html",
|
||||||
|
openAnalyzer: false,
|
||||||
|
}),
|
||||||
|
] : []),
|
||||||
|
};
|
||||||
|
return bundleConfig;
|
||||||
|
};
|
@ -0,0 +1,4 @@
|
|||||||
|
// https://github.com/aspnet/JavaScriptServices/issues/1046
|
||||||
|
|
||||||
|
require('ts-node/register')
|
||||||
|
module.exports = require("./webpack.config.ts");
|
Loading…
Reference in new issue