Skip to content

Instantly share code, notes, and snippets.

@nshimiye
Last active April 19, 2020 01:00
Show Gist options
  • Save nshimiye/c86275947fd2f2fe1d1e61cdd29a1b55 to your computer and use it in GitHub Desktop.
Save nshimiye/c86275947fd2f2fe1d1e61cdd29a1b55 to your computer and use it in GitHub Desktop.
webpack and angular compiler
{
"name": "webpack-tsc-ngc",
"version": "1.0.0",
"description": "Webpack Angular Compiler",
"scripts": {
"build:tsc": "webpack --config webpack.config.tsc.js",
"build:ngc": "webpack --config webpack.config.ngc.js",
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@angular/common": "7.2.14",
"@angular/compiler": "7.2.14",
"@angular/core": "7.2.14",
"@angular/platform-browser": "7.2.14",
"@angular/platform-browser-dynamic": "7.2.14",
"rxjs": "6.5.5",
"ts-loader": "^6.2.1",
"zone.js": "0.8.29"
},
"devDependencies": {
"@angular-devkit/build-optimizer": "0.13.8",
"@angular/compiler-cli": "^7.2.14",
"@ngtools/webpack": "^7.3.8",
"typescript": "^3.2.4",
"webpack": "4.42.0",
"webpack-cli": "3.3.11"
}
}
const { AngularCompilerPlugin } = require('@ngtools/webpack');
module.exports = {
mode: 'none',
entry: './index.ts',
output: { filename: 'main.js' },
resolve: {
extensions: ['.ts', '.js']
},
plugins: [
new AngularCompilerPlugin({
tsConfigPath: './tsconfig.json',
skipCodeGeneration: true // prevent compiler to look for html templates
})
],
module: {
rules: [
{
test: /\.ts$/,
loader: '@ngtools/webpack'
}
]
}
};
module.exports = {
mode: 'none',
entry: './index.ts',
output: { filename: 'main.js' },
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader'
}
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment