diff --git a/demo/src/app/app.module.ts b/demo/src/app/app.module.ts index 91fdbf7639..901a329307 100644 --- a/demo/src/app/app.module.ts +++ b/demo/src/app/app.module.ts @@ -29,7 +29,6 @@ import { environment } from '../environments/environment'; ], imports: [ DocsModule, - BrowserModule, FormsModule, HttpModule, RouterModule.forRoot(routes, {useHash: environment.useHash}), diff --git a/demo/src/index.html b/demo/src/index.html index 83aa3f4fb9..27b535bdec 100644 --- a/demo/src/index.html +++ b/demo/src/index.html @@ -26,7 +26,6 @@ - diff --git a/package.json b/package.json index e607b61f5f..951dee549d 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,8 @@ "view-stats": "webpack-bundle-analyzer demo/dist/stats.json", "build:dynamic": "npm run build:client-and-server-bundles && npm run webpack:server", "serve:dynamic": "node demo/dist/server.js", - "build:client-and-server-bundles": "ng build --prod --env=server && ng build --prod --env=server --app 1 --output-hashing=false", - "webpack:server": "webpack --config webpack.server.config.js --progress --colors" + "build:client-and-server-bundles": "ng build -bh / --prod --env=server && ng build -bh / --prod --env=server --app 1 --output-hashing=false", + "webpack:server": "webpack --config ./scripts/universal/webpack.server.config.js --progress --colors" }, "main": "bundles/ngx-bootstrap.umd.js", "module": "index.js", diff --git a/prerender.ts b/scripts/universal/prerender.ts similarity index 94% rename from prerender.ts rename to scripts/universal/prerender.ts index fdb5c35a39..0c088a4013 100644 --- a/prerender.ts +++ b/scripts/universal/prerender.ts @@ -16,7 +16,7 @@ import { renderModuleFactory } from '@angular/platform-server'; import { ROUTES } from './static.paths'; // * NOTE :: leave this as require() since this file is built Dynamically from webpack -const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./demo/dist/server/main.bundle'); +const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('../../demo/dist/server/main.bundle'); const BROWSER_FOLDER = join(process.cwd(), 'browser'); @@ -27,7 +27,7 @@ let previousRender = Promise.resolve(); // Iterate each route path ROUTES.forEach(route => { - var fullPath = join(BROWSER_FOLDER, route); + const fullPath = join(BROWSER_FOLDER, route); // Make sure the directory structure is there if(!existsSync(fullPath)){ diff --git a/server.ts b/scripts/universal/server.ts similarity index 97% rename from server.ts rename to scripts/universal/server.ts index ec4905fca1..9b319d74dd 100644 --- a/server.ts +++ b/scripts/universal/server.ts @@ -22,7 +22,7 @@ const DIST_FOLDER = join(process.cwd(), 'demo/dist'); const template = readFileSync(join(DIST_FOLDER, 'browser', 'index.html')).toString(); // * NOTE :: leave this as require() since this file is built Dynamically from webpack -const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./demo/dist/server/main.bundle'); +const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('../../demo/dist/server/main.bundle'); const { provideModuleMap } = require('@nguniversal/module-map-ngfactory-loader'); diff --git a/static.paths.ts b/scripts/universal/static.paths.ts similarity index 100% rename from static.paths.ts rename to scripts/universal/static.paths.ts diff --git a/webpack.server.config.js b/scripts/universal/webpack.server.config.js similarity index 85% rename from webpack.server.config.js rename to scripts/universal/webpack.server.config.js index c57ee21ca6..d819bbdcf9 100644 --- a/webpack.server.config.js +++ b/scripts/universal/webpack.server.config.js @@ -2,13 +2,13 @@ const path = require('path'); const webpack = require('webpack'); module.exports = { - entry: { server: './server.ts', prerender: './prerender.ts' }, + entry: { server: './scripts/universal/server.ts', prerender: './scripts/universal/prerender.ts' }, resolve: { extensions: ['.ts', '.js'] }, target: 'node', // this makes sure we include node_modules and other 3rd party libraries externals: [/(node_modules|main\..*\.js)/], output: { - path: path.join(__dirname, 'demo/dist'), + path: path.join(__dirname, '../../demo/dist'), filename: '[name].js' }, module: {