Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This configuration is part of : https://stackoverflow.com/questions/50405930/aot-angular-6-directive-somecomponent-expected-0-arguments-but-got-1-for
- My extracted configuration :
- *Section rules and loader*
- rules: [
- /**
- * Compiles TypeScript files.
- */
- {
- test: /\.tsx?$/,
- use: [{
- loader: 'babel-loader'
- },
- {
- loader: '@ngtools/webpack'
- }
- ]
- }
- ]
- *Section plugins*
- [
- new AngularCompilerPlugin(
- {
- tsConfigPath: ROOT + '/tsconfig.json',
- entryModule: ROOT + '/path/to/app.module/#AppModule'
- }),
- /**
- * Webpack plugin to optimize a JavaScript file for faster initial load
- * by wrapping eagerly-invoked functions.
- *
- * See: https://github.com/vigneshshanmugam/optimize-js-plugin
- */
- new OptimizeJsPlugin(
- {
- sourceMap: false
- }),
- /**
- * Minify all javascript, switch loaders to minimizing mode
- * Reference: https://webpack.js.org/plugins/uglifyjs-webpack-plugin/
- */
- new UglifyJsPlugin(
- {
- cache: true,
- parallel: true,
- uglifyOptions:
- {
- ecma: 5,
- mangle: true,
- keep_classnames: true,
- compress:
- {
- drop_console: true,
- warnings: false,
- conditionals: true,
- unused: true,
- comparisons: true,
- sequences: true,
- dead_code: true,
- evaluate: true,
- if_return: true,
- join_vars: true,
- negate_iife: false // we need this for lazy v8
- }
- },
- }),
- /**
- * Plugin: NormalModuleReplacementPlugin
- * Description: Replace resources that matches resourceRegExp with newResource
- *
- * See: http://webpack.github.io/docs/list-of-plugins.html#normalmodulereplacementplugin
- */
- new NormalModuleReplacementPlugin(
- /angular2-hmr/,
- '@ngApp/empty.js'
- ),
- new NormalModuleReplacementPlugin(
- /zone\.js(\\|\/)dist(\\|\/)long-stack-trace-zone/,
- '@ngApp/empty.js'
- ),
- ]
- *section tsconfig.json*
- {
- "exclude": [
- "node_modules",
- "vendor"
- ],
- "include": [
- "src",
- "node_modules/@nicky-lenaers/ngx-scroll-to"
- ],
- "compileOnSave": false,
- "compilerOptions": {
- "sourceMap": true,
- "declaration": false,
- "moduleResolution": "node",
- "emitDecoratorMetadata": true,
- "experimentalDecorators": true,
- "noImplicitAny": true,
- "suppressImplicitAnyIndexErrors": true,
- "allowSyntheticDefaultImports": true,
- "target": "es2015",
- "types": ["node","velocity-animate"],
- "typeRoots": [
- "node_modules/@types"
- ]
- },
- "angularCompilerOptions": {
- "fullTemplateTypeCheck": true,
- "preserveWhitespaces": true
- },
- "awesomeTypescriptLoaderOptions": {
- "forkChecker": true,
- "useWebpackText": true
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement