Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const path = require('path');
- const ProgressPlugin = require('webpack/lib/ProgressPlugin');
- const HtmlWebpackPlugin = require('html-webpack-plugin');
- const ExtractTextPlugin = require('extract-text-webpack-plugin');
- const autoprefixer = require('autoprefixer');
- const postcssUrl = require('postcss-url');
- const cssnano = require('cssnano');
- const { NoEmitOnErrorsPlugin, DefinePlugin, HashedModuleIdsPlugin } = require('webpack');
- const { GlobCopyWebpackPlugin, BaseHrefWebpackPlugin, SuppressExtractedTextChunksWebpackPlugin } = require('@angular/cli/plugins/webpack');
- const { CommonsChunkPlugin, UglifyJsPlugin } = require('webpack').optimize;
- const { AotPlugin } = require('@ngtools/webpack');
- const nodeModules = path.join(process.cwd(), 'node_modules');
- const entryPoints = ["inline", "polyfills", "sw-register", "styles", "vendor", "main"];
- const minimizeCss = true;
- const baseHref = "/home";
- const deployUrl = "/app/uds";
- const postcssPlugins = function () {
- return [
- autoprefixer(),
- postcssUrl({
- url: (URL) => {
- // Only convert root relative URLs, which CSS-Loader won't process into require().
- if (!URL.startsWith('/') || URL.startsWith('//')) {
- return URL;
- }
- if (deployUrl.match(/:///)) {
- // If deployUrl contains a scheme, ignore baseHref use deployUrl as is.
- return `${deployUrl.replace(//$/, '')}${URL}`;
- }
- else if (baseHref.match(/:///)) {
- // If baseHref contains a scheme, include it as is.
- return baseHref.replace(//$/, '') +
- `/${deployUrl}/${URL}`.replace(///+/g, '/');
- }
- else {
- // Join together base-href, deploy-url and the original URL.
- // Also dedupe multiple slashes into single ones.
- return `/${baseHref}/${deployUrl}/${URL}`.replace(///+/g, '/');
- }
- }
- })
- ].concat(minimizeCss ? [cssnano({ safe: true, autoprefixer: false })] : []);
- };
- module.exports = {
- "devtool": "source-map",
- "resolve": {
- "extensions": [
- ".ts",
- ".js"
- ],
- "modules": [
- "./node_modules"
- ]
- },
- "resolveLoader": {
- "modules": [
- "./node_modules"
- ]
- },
- "entry": {
- "main": [
- path.join(process.cwd(), ".app/src/main.ts")
- ],
- "polyfills": [
- path.join(process.cwd(), ".app/src/polyfills.ts")
- ],
- "styles": [
- path.join(process.cwd(), ".app/src/styles.css")
- ]
- },
- "output": {
- "path": path.join(process.cwd(), "./dist/out"),
- "publicPath": "/app/uds",
- "filename": "[name].[chunkhash:20].bundle.js",
- "chunkFilename": "[id].[chunkhash:20].chunk.js"
- },
- "module": {
- "rules": [
- {
- "enforce": "pre",
- "test": /.js$/,
- "loader": "source-map-loader",
- "exclude": [
- //node_modules//
- ]
- },
- {
- "test": /.json$/,
- "loader": "json-loader"
- },
- {
- "test": /.html$/,
- "loader": "raw-loader"
- },
- {
- "test": /.(eot|svg)$/,
- "loader": "file-loader?name=[name].[hash:20].[ext]"
- },
- {
- "test": /.(jpg|png|gif|otf|ttf|woff|woff2|cur|ani)$/,
- "loader": "url-loader?name=[name].[hash:20].[ext]&limit=10000"
- },
- {
- "exclude": [
- const path = require('path')
- ],
- "test": /.css$/,
- "use": [
- "exports-loader?module.exports.toString()",
- {
- "loader": "css-loader",
- "options": {
- "sourceMap": true,
- "importLoaders": 1
- }
- },
- {
- "loader": "postcss-loader",
- "options": {
- "ident": "postcss",
- "plugins": postcssPlugins
- }
- }
- ]
- },
- {
- "exclude": [
- const path = require('path')
- ],
- "test": /.scss$|.sass$/,
- "use": [
- "exports-loader?module.exports.toString()",
- {
- "loader": "css-loader",
- "options": {
- "sourceMap": true,
- "importLoaders": 1
- }
- },
- {
- "loader": "postcss-loader",
- "options": {
- "ident": "postcss",
- "plugins": postcssPlugins
- }
- },
- {
- "loader": "sass-loader",
- "options": {
- "sourceMap": true,
- "precision": 8,
- "includePaths": []
- }
- }
- ]
- },
- {
- "exclude": [
- const path = require('path')
- ],
- "test": /.less$/,
- "use": [
- "exports-loader?module.exports.toString()",
- {
- "loader": "css-loader",
- "options": {
- "sourceMap": true,
- "importLoaders": 1
- }
- },
- {
- "loader": "postcss-loader",
- "options": {
- "ident": "postcss",
- "plugins": postcssPlugins
- }
- },
- {
- "loader": "less-loader",
- "options": {
- "sourceMap": true
- }
- }
- ]
- },
- {
- "exclude": [
- const path = require('path')
- ],
- "test": /.styl$/,
- "use": [
- "exports-loader?module.exports.toString()",
- {
- "loader": "css-loader",
- "options": {
- "sourceMap": true,
- "importLoaders": 1
- }
- },
- {
- "loader": "postcss-loader",
- "options": {
- "ident": "postcss",
- "plugins": postcssPlugins
- }
- },
- {
- "loader": "stylus-loader",
- "options": {
- "sourceMap": true,
- "paths": []
- }
- }
- ]
- },
- {
- "include": [
- const path = require('path')
- ],
- "test": /.css$/,
- "loaders": ExtractTextPlugin.extract({
- "use": [
- {
- "loader": "css-loader",
- "options": {
- "sourceMap": true,
- "importLoaders": 1
- }
- },
- {
- "loader": "postcss-loader",
- "options": {
- "ident": "postcss",
- "plugins": postcssPlugins
- }
- }
- ],
- "fallback": "style-loader",
- "publicPath": ""
- })
- },
- {
- "include": [
- const path = require('path')
- ],
- "test": /.scss$|.sass$/,
- "loaders": ExtractTextPlugin.extract({
- "use": [
- {
- "loader": "css-loader",
- "options": {
- "sourceMap": true,
- "importLoaders": 1
- }
- },
- {
- "loader": "postcss-loader",
- "options": {
- "ident": "postcss",
- "plugins": postcssPlugins
- }
- },
- {
- "loader": "sass-loader",
- "options": {
- "sourceMap": true,
- "precision": 8,
- "includePaths": []
- }
- }
- ],
- "fallback": "style-loader",
- "publicPath": ""
- })
- },
- {
- "include": [
- const path = require('path')
- ],
- "test": /.less$/,
- "loaders": ExtractTextPlugin.extract({
- "use": [
- {
- "loader": "css-loader",
- "options": {
- "sourceMap": true,
- "importLoaders": 1
- }
- },
- {
- "loader": "postcss-loader",
- "options": {
- "ident": "postcss",
- "plugins": postcssPlugins
- }
- },
- {
- "loader": "less-loader",
- "options": {
- "sourceMap": true
- }
- }
- ],
- "fallback": "style-loader",
- "publicPath": ""
- })
- },
- {
- "include": [
- const path = require('path')
- ],
- "test": /.styl$/,
- "loaders": ExtractTextPlugin.extract({
- "use": [
- {
- "loader": "css-loader",
- "options": {
- "sourceMap": true,
- "importLoaders": 1
- }
- },
- {
- "loader": "postcss-loader",
- "options": {
- "ident": "postcss",
- "plugins": postcssPlugins
- }
- },
- {
- "loader": "stylus-loader",
- "options": {
- "sourceMap": true,
- "paths": []
- }
- }
- ],
- "fallback": "style-loader",
- "publicPath": ""
- })
- },
- {
- "test": /.ts$/,
- "loader": "@ngtools/webpack"
- }
- ]
- },
- "plugins": [
- new NoEmitOnErrorsPlugin(),
- new GlobCopyWebpackPlugin({
- "patterns": [
- "assets"
- ],
- "globOptions": {
- "cwd": path.join(process.cwd(), "src/main/app/src/"),
- "dot": true,
- "ignore": "**/.gitkeep"
- }
- }),
- new ProgressPlugin(),
- new HtmlWebpackPlugin({
- "template": path.join(process.cwd(), "src/main/template.ftl"),
- "filename": path.join(process.cwd(), "dist/out/udsspa.ftl"),
- "hash": true,
- "inject": false,
- "compile": true,
- "favicon": false,
- "minify": false,
- "cache": true,
- "showErrors": true,
- "chunks": "all",
- "excludeChunks": [],
- "title": "Unified Deployment Systeme",
- "xhtml": true,
- "chunksSortMode": function sort(left, right) {
- let leftIndex = entryPoints.indexOf(left.names[0]);
- let rightindex = entryPoints.indexOf(right.names[0]);
- if (leftIndex > rightindex) {
- return 1;
- }
- else if (leftIndex < rightindex) {
- return -1;
- }
- else {
- return 0;
- }
- }
- }),
- new BaseHrefWebpackPlugin({
- "baseHref": "/home"
- }),
- new CommonsChunkPlugin({
- "name": "inline",
- "minChunks": null
- }),
- new CommonsChunkPlugin({
- "name": "vendor",
- "minChunks": (module) => module.resource && module.resource.startsWith(nodeModules),
- "chunks": [
- "main"
- ]
- }),
- new ExtractTextPlugin({
- "filename": "[name].[contenthash:20].bundle.css",
- "disable": false,
- "allChunks": true
- }),
- new SuppressExtractedTextChunksWebpackPlugin(),
- new DefinePlugin({
- "process.env.NODE_ENV": ""production""
- }),
- new HashedModuleIdsPlugin({
- "hashFunction": "md5",
- "hashDigest": "base64",
- "hashDigestLength": 4
- }),
- new UglifyJsPlugin({
- "mangle": {
- "screw_ie8": true
- },
- "compress": {
- "screw_ie8": true,
- "warnings": false
- },
- "sourceMap": true
- }),
- new AotPlugin({
- "mainPath": "main.ts",
- "hostReplacementPaths": {
- "environments/environment.ts": "environments/environment.prod.ts"
- },
- "exclude": [],
- "tsConfigPath": path.join(process.cwd(), ".app/src/tsconfig.app.json")
- })
- ],
- "node": {
- "fs": "empty",
- "global": true,
- "crypto": "empty",
- "tls": "empty",
- "net": "empty",
- "process": true,
- "module": false,
- "clearImmediate": false,
- "setImmediate": false
- },
- "devServer": {
- "historyApiFallback": true
- }
- };
- <% for (key in htmlWebpackPlugin.files.js) { %>
- <script src="<@spring.url '<%= htmlWebpackPlugin.files.js[key].entry %>'/>" type="text/javascript"></script>
- <% } %>
- <% for (key in htmlWebpackPlugin.files.css) { %>
- <link href="<@spring.url '<%= htmlWebpackPlugin.files.css[key].entry %>'/>" rel="stylesheet" type="text/css"/></link>
- <% } %>
- <script src="<@spring.url ''/>" type="text/javascript"></script>
- <script src="<@spring.url ''/>" type="text/javascript"></script>
- <script src="<@spring.url ''/>" type="text/javascript"></script>
- <script src="<@spring.url ''/>" type="text/javascript"></script>
- <script src="<@spring.url ''/>" type="text/javascript"></script>
- <link href="<@spring.url ''/>" rel="stylesheet" type="text/css"/></link>
- <% for (key in htmlWebpackPlugin.files.chunks) { %>
- <script src="<@spring.url '<%= htmlWebpackPlugin.files.chunks[key].entry %>'/>" type="text/javascript"></script>
- <% } %>
- <script src="<@spring.url '/app/inline.4cffe6e368f2c7d07127.bundle.js?532843813b34c259df54'/>" type="text/javascript"></script>
- <script src="<@spring.url '/app/polyfills.39a48f2e3268ad54bc6c.bundle.js?532843813b34c259df54'/>" type="text/javascript"></script>
- <script src="<@spring.url '/app/styles.49cb3bdd2d9987c8cbf2.bundle.css?532843813b34c259df54'/>" type="text/javascript"></script>
- <script src="<@spring.url '/app/vendor.1f6f6ff98fc2878385b4.bundle.js?532843813b34c259df54'/>" type="text/javascript"></script>
- <script src="<@spring.url '/app/uds/main.411bdc137897ab45279c.bundle.js?532843813b34c259df54'/>" type="text/javascript"></script>
Add Comment
Please, Sign In to add comment