question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error on webpack --env.prod

See original GitHub issue

Bug, feature request, or proposal:

I use VS 2017 Angular SPA. I added Material and all works OK in development mode.

When trying to publish application the webpack process fails:

command: webpack --env.prod

 Hash:` 2eb8c943b24c06b91e475086fcf6155c05ab4f19
 Version: webpack 2.5.1
 Child
     Hash: 2eb8c943b24c06b91e47
     Time: 23429ms
              Asset    Size  Chunks             Chunk Names
     main-client.js  247 kB       0  [emitted]  main-client
 
     ERROR in ./$$_gendir/~/@angular/material/dialog/typings/index.ngfactory.ts
     Module parse failed:      C:\...\WebApplication1\$$_gendir\node_modules\@angular\

material\dialog\typings\index.ngfactory.ts Unexpected token (20:37) You may need an appropriate loader to handle this file type. | import * as i9 from ‘@angular/cdk/portal’; | import * as i10 from ‘@angular/material/core’; | export const MatDialogModuleNgFactory:i0.NgModuleFactory<i1.MatDialogModule> = i0.ɵcmf(i1.MatDialogModule, | ([] as any[]),(_l:any) => { | return i0.ɵmod([i0.ɵmpd(512,i0.ComponentFactoryResolver,i0.ɵCodegenComponentFactoryResolver, @ ./$$_gendir/ClientApp/app/app.module.browser.ngfactory.ts 10:0-103 @ ./ClientApp/boot.browser.ts

E     RROR in ./$$_gendir/~/@angular/material/datepicker/typings/index.ngfactory.ts
     Module parse failed: C:\...\WebApplication1\$$_gendir\node_modules\@angular\

material\datepicker\typings\index.ngfactory.ts Unexpected token (27:41) You may need an appropriate loader to handle this file type. | import * as i16 from ‘…/…/button/typings/index.ngfactory’; | import * as i17 from ‘…/…/icon/typings/index.ngfactory’; | export const MatDatepickerModuleNgFactory:i0.NgModuleFactory<i1.MatDatepickerModule> = i0.ɵcmf(i1.MatDatepickerMod ule, | ([] as any[]),(_l:any) => { | return i0.ɵmod([i0.ɵmpd(512,i0.ComponentFactoryResolver,i0.ɵCodegenComponentFactoryResolver, @ ./$$_gendir/ClientApp/app/app.module.browser.ngfactory.ts 11:0-107 @ ./ClientApp/boot.browser.ts `

What is the expected behavior?

What is the current behavior?

What are the steps to reproduce?

Providing a StackBlitz/Plunker (or similar) is the best way to get the team to see your issue.
Plunker starter (using on @master): https://goo.gl/DlHd6U
StackBlitz starter (using latest npm release): https://goo.gl/wwnhMV

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 4.4.4 Material beta 12, Typescript 2.3, Windows, Visual Studio 2017 Up 3

Is there anything else we should know?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
shibut12commented, Oct 13, 2017

@hiepxanh @neojg Removing include: /ClientApp/ from webpack.config.js file fixed this issue for me. see more here issues/1168

0reactions
angular-automatic-lock-bot[bot]commented, Sep 7, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom errors for webpack: checking for env variables
The best solution I've come up with so far is writing a simple webpack plugin that checks for the existence of each environment...
Read more >
Unknown argument: --env · Issue #1216 · webpack/webpack-cli
Describe the bug I'm trying to set my webpack env for configuration purposes with webpack ... [fix] Error: Unknown option '--env.production'
Read more >
Environment Variables - webpack
The webpack command line environment option --env allows you to pass in as many environment variables as you like. Environment variables will be...
Read more >
Using environment variables with Webpack - Prateek Surana
A guide for setting up and using environment variables with Webpack and handling different values for Production and Development ...
Read more >
A Dead Simple Guide to Using Environment Variables in Your ...
A Dead Simple Guide to Using Environment Variables in Your Front End with Webpack. If you are using APIs in your React app,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found