Skip to content

Instantly share code, notes, and snippets.

@SaravananSeenivasan
Last active December 15, 2016 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SaravananSeenivasan/05261250e652a58039302ab8607f710e to your computer and use it in GitHub Desktop.
Save SaravananSeenivasan/05261250e652a58039302ab8607f710e to your computer and use it in GitHub Desktop.
webpack demo - project 1
import { Component } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'Root',
template: ` <div>
<h4>Sample Component</h4>
<dfn> {{sample_def}} </dfn>
</div>
`
})
export class Rootcomponent {
sample_def = "Sample data rendered from component";
constructor() {
console.log("Root");
}
}
var webpack = require("webpack");
var path = require("path");
module.exports = {
entry: {
'app': './app/app.module.ts'
},
output: {
filename: '[name]/dist/bundle.js',
libraryTarget: "umd"
},
module: {
loaders: [{
test: /\.css$/,
exclude: /node_modules/,
loader: 'style!css'
},
{
test: /\.html$/,
loader: "html"
},
{
test: /\.ts$/,
loader: 'awesome-typescript-loader'
},
],
},
resolve: {
extensions: ['', '.ts', '.js']
},
htmlLoader: {
ignoreCustomFragments: [/\{\{.*?}}/],
root: path.resolve(__dirname, 'assets'),
attrs: ['img:src', 'link:href']
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment