Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package.json:
- {
- "name": "test",
- "version": "1.0.0",
- "scripts": {
- "start": "node_modules/.bin/webpack --progress"
- },
- "devDependencies": {
- "@ngtools/webpack": "^6.0.8",
- "css-loader": "^0.28.11",
- "html-webpack-plugin": "^3.2.0",
- "mini-css-extract-plugin": "^0.4.0",
- "raw-loader": "^0.5.1",
- "typescript": "^2.7.2",
- "webpack": "^4.12.0",
- "webpack-cli": "^3.0.8"
- },
- "dependencies": {
- "@angular/common": "^6.0.6",
- "@angular/compiler": "^6.0.6",
- "@angular/compiler-cli": "^6.0.6",
- "@angular/core": "^6.0.6",
- "@angular/platform-browser": "^6.0.6",
- "@angular/platform-browser-dynamic": "^6.0.6"
- }
- }
- ---------------------------------------------------------------------------
- tsconfig.json:
- {
- "compilerOptions": {
- "target": "es6",
- "sourceMap": true,
- "module": "commonjs",
- "experimentalDecorators": true,
- "emitDecoratorMetadata": true,
- "outDir": "app",
- },
- "exclude": [
- "node_modules"
- ],
- "lib": [
- "dom",
- "es2015"
- ],
- "angularCompilerOptions": {
- "fullTemplateTypeCheck": true,
- "preserveWhitespaces": true
- }
- }
- ---------------------------------------------------------------------------
- webpack.config.js:
- const HtmlWebpackPlugin = require("html-webpack-plugin");
- const { AngularCompilerPlugin } = require("@ngtools/webpack");
- const MiniCssExtractPlugin = require("mini-css-extract-plugin");
- module.exports = () => {
- return {
- entry: "./src/main.ts",
- output: {
- path: __dirname + "/application",
- filename: "app.js"
- },
- resolve: {
- extensions: [".ts", ".js"]
- },
- mode: "production",
- module: {
- rules: [
- {
- test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
- loader: "@ngtools/webpack"
- },
- {
- test: /\.html$/,
- loader: "raw-loader"
- },
- {
- test: /\.css$/,
- use: [
- MiniCssExtractPlugin.loader,
- "css-loader"
- ]
- }
- ]
- },
- plugins: [
- new HtmlWebpackPlugin({
- template: __dirname + "/src/index.html",
- output: __dirname + "/dist",
- inject: "head",
- hash: true
- }),
- new MiniCssExtractPlugin({
- filename: "[name].css"
- }),
- new AngularCompilerPlugin({
- tsConfigPath: "./tsconfig.json",
- entryModule: __dirname + "/src/application/application.module#ApplicationModule",
- skipCodeGeneration: false
- })
- ]
- };
- }
- ---------------------------------------------------------------------------
- src/index.html:
- <html>
- <head>
- <title>App</title>
- </head>
- <body>
- <app></app>
- </body>
- </html>
- ---------------------------------------------------------------------------
- src/main.ts:
- import { enableProdMode } from "@angular/core";
- import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
- import { ApplicationModule } from "./application/application.module";
- enableProdMode();
- platformBrowserDynamic().bootstrapModule(ApplicationModule);
- ---------------------------------------------------------------------------
- src/styles/style.css:
- body, html {
- height: 100%;
- width: 100%;
- }
- ---------------------------------------------------------------------------
- src/application/application.component.html:
- Test
- ---------------------------------------------------------------------------
- src/application/application.component.ts:
- import { Component } from "@angular/core";
- @Component({
- selector: "app",
- templateUrl: "./application.component.html",
- styleUrls: ["../styles/style.css"],
- })
- export class ApplicationComponent {
- }
- ---------------------------------------------------------------------------
- src/application/application.module.ts:
- import { NgModule } from "@angular/core";
- import { BrowserModule } from "@angular/platform-browser"
- import { ApplicationComponent } from "./application.component";
- @NgModule({
- imports: [BrowserModule],
- declarations: [
- ApplicationComponent,
- ],
- bootstrap: [ApplicationComponent]
- })
- export class ApplicationModule {
- }
- ---------------------------------------------------------------------------
Add Comment
Please, Sign In to add comment