Prod build failed
step to reproduce
download the project from branch "master"
npm install
npm run build:prod
has the next bug

the regexp should be as this one

how can i skip minimization for current regexp?
I have the same problem when deploying the latest starter (Angular 5) to my web hosting provider (the previous Angular 4 version runs OK in the same server).
See: "...Prerendering failed because of error: SyntaxError: Invalid regular expression: /^[_A-Za- ... ". Including error and part of the stack trace below:
Hosting environment: Production
Content root path: C:\ClientSites\aztectechnologies.net\paroissesaintremi.online
Now listening on: http://localhost:27973
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
at Object.create.location.get (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1542:16379)
at __webpack_require__ (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1:355)
at Object.<anonymous> (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1030:27089)
at __webpack_require__ (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1:355)
at Object.exports.isValidName (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1542:2523)
at __webpack_require__ (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1:355)
at Object.module.exports (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1091:2699)
at __webpack_require__ (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1:355)
at Object.module.exports (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1939:412)
Current directory is: C:\ClientSites\aztectechnologies.net\paroissesaintremi.online
at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Request starting HTTP/1.1 GET http://paroissesaintremi.online/
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method AspCoreServer.Controllers.HomeController.Index (Asp2017) with arguments ((null)) - ModelState is Valid
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Executed action AspCoreServer.Controllers.HomeController.Index (Asp2017) in 1924.9405ms
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HL941CASFAVL", Request id "0HL941CASFAVL:00000001": An unhandled exception was thrown by the application.
Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: Prerendering failed because of error: SyntaxError: Invalid regular expression: /^[_A-Za-zA-�O-�o-??-??-??-?�-??-??-??-??-??-??-?:][-._A-Za-z0-9�A-�O-�o-?`-??-?????�-??-??-??-??-??-??-?:]*$/: Range out of order in character class
at RegExp (native)
at Object.create.location.get (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1542:16379)
at __webpack_require__ (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1:355)
at Object.<anonymous> (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1030:27089)
at __webpack_require__ (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1:355)
at Object.exports.isValidName (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1542:2523)
at __webpack_require__ (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1:355)
at Object.module.exports (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1091:2699)
at __webpack_require__ (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1:355)
at Object.module.exports (C:\ClientSites\aztectechnologies.net\paroissesaintremi.online\ClientApp\dist\main-server.js:1939:412)
Current directory is: C:\ClientSites\aztectechnologies.net\paroissesaintremi.online
at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
yes,vs2017 Release run console error: "...Prerendering failed because of error: SyntaxError: Invalid regular expression: /^[_A-Za- ... ". Including error and part of the stack trace below:
but vs2017 debug run iisexpress OK; vs2017 Release run iisexpress error:
An error occurred while starting the application.
AggregateException: One or more errors occurred. (Cannot find module './wwwroot/dist/vendor-manifest.json'
Error: Cannot find module './wwwroot/dist/vendor-manifest.json'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at module.exports (F:\test\aspnetcore-angular2-universal\webpack.config.js:51:27)
at createWebpackDevServer (F:\test\aspnetcore-angular2-universal\node_modules\aspnet-webpack\WebpackDevMiddleware.js:194:31)
at createWebpackDevServer (C:\Users\arlen\AppData\Local\Temp\bruj3kay.nrv:74:50)
at C:\Users\arlen\AppData\Local\Temp\i4jdk5mx.zmu:114:19
at IncomingMessage.
NodeInvocationException: Cannot find module './wwwroot/dist/vendor-manifest.json'
Error: Cannot find module './wwwroot/dist/vendor-manifest.json'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at module.exports (F:\test\aspnetcore-angular2-universal\webpack.config.js:51:27)
at createWebpackDevServer (F:\test\aspnetcore-angular2-universal\node_modules\aspnet-webpack\WebpackDevMiddleware.js:194:31)
at createWebpackDevServer (C:\Users\arlen\AppData\Local\Temp\bruj3kay.nrv:74:50)
at C:\Users\arlen\AppData\Local\Temp\i4jdk5mx.zmu:114:19
at IncomingMessage.
AggregateException: One or more errors occurred. (Cannot find module './wwwroot/dist/vendor-manifest.json'
Error: Cannot find module './wwwroot/dist/vendor-manifest.json' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at module.exports (F:\test\aspnetcore-angular2-universal\webpack.config.js:51:27) at createWebpackDevServer (F:\test\aspnetcore-angular2-universal\node_modules\aspnet-webpack\WebpackDevMiddleware.js:194:31) at createWebpackDevServer (C:\Users\arlen\AppData\Local\Temp\bruj3kay.nrv:74:50) at C:\Users\arlen\AppData\Local\Temp\i4jdk5mx.zmu:114:19 at IncomingMessage.
Show raw exception details
NodeInvocationException: Cannot find module './wwwroot/dist/vendor-manifest.json'
Error: Cannot find module './wwwroot/dist/vendor-manifest.json' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at module.exports (F:\test\aspnetcore-angular2-universal\webpack.config.js:51:27) at createWebpackDevServer (F:\test\aspnetcore-angular2-universal\node_modules\aspnet-webpack\WebpackDevMiddleware.js:194:31) at createWebpackDevServer (C:\Users\arlen\AppData\Local\Temp\bruj3kay.nrv:74:50) at C:\Users\arlen\AppData\Local\Temp\i4jdk5mx.zmu:114:19 at IncomingMessage.
Show raw exception details
Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: Cannot find module './wwwroot/dist/vendor-manifest.json'
Error: Cannot find module './wwwroot/dist/vendor-manifest.json'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at module.exports (F:\test\aspnetcore-angular2-universal\webpack.config.js:51:27)
at createWebpackDevServer (F:\test\aspnetcore-angular2-universal\node_modules\aspnet-webpack\WebpackDevMiddleware.js:194:31)
at createWebpackDevServer (C:\Users\arlen\AppData\Local\Temp\bruj3kay.nrv:74:50)
at C:\Users\arlen\AppData\Local\Temp\i4jdk5mx.zmu:114:19
at IncomingMessage.1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__101.MoveNext()
I’ll take a look tomorrow! Must of forgotten to update something there for prod builds... if anyone finds out what it is, let us know!
Thank you! I also found that the error: (Error: SyntaxError: Invalid regular expression: / ^), I use Chrome to refresh the page, the page is successful; But AggregateException: One or more errors occurred. (Can not find module './wwwroot/dist/vendor-manifest.json', I use Chrome to refresh the page, unsuccessfully. As a beginner, do not know the details of ng5.0universal change @nguniversal; @ angular / platform-server and so on. I compare GIT history, did not find package.json and webpack.config.vendor.js, the package conflict or missing something. Summary: debug mode successful, release mode unsuccessful. vs2017 posted to AZURE, debug and release, are http500;
looks like I have related issue. On production build in chrome it throw this error:
main-client.js:299 Uncaught SyntaxError: Invalid regular expression: /^[_A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-��--�:][-._A-Za-z0-9·À-ÖØ-öø-˿̀-ͽͿ-‿⁀⁰-Ⰰ-、-豈-﷏ﷰ-��--�:]*$/: Range out of order in character class
at new RegExp (
Same here, seems that some issues occurred during minification, Commenting out of UglifyJS plugin fixing this.
Hi statuev,
I think that I tried the same but likely I deployed the wrong package (I got the same error). I tried many ad-hoc things. Do you mind copy and pasting the lines that you commented out so I can give it a try? Is this in the webpack configuration?
Same issue on build:prod, i've tried to comment uglyfy without any result.
@alexbenitez
Basically, it will be any UglifyJS plugin entry in webpack configuration. I'm using slightly modified version of this package for my own project, so maybe there was something more. I'll try to repeat steps for exactly this package. However, after resolving I've got new strange issue (only for server-side render) - ENONENT 'project_root_folder/my-component.view.html'
This is exactly what i have when i comment uglyfy. Server side can't find a component.
Yep... that's what I got without uglyfy. The Starter as is does not work in Prod mode.
Hi,
yea. there is uglyfy
UglifyJS unescapes \u0000 and other unicode char code strings and converts them . this results in some libraries (eg,js-base64,firebase) getting screwed up, and Chrome refusing to load the extension b/c theinjectionisn'tutf-8`.
I had a similar problem and it happened because I'm using WebPack's uglify which does the compression of unicode characters to UTF-8 and the server wasn't specifying UTF-8 as the charset causing the browser to fail to properly parse it. (https://github.com/lodash/lodash/issues/2625)
need to set output: { ascii_only: true, beautify: false, }(https://github.com/zalmoxisus/crossbuilder/commit/6c70ff4650efd346211c221d97390a143cf5ef8e)
also I noticed we use 0.4.6, and 1.0.0 version
Eugene
I tried replacing Uglify with the following (as per https://github.com/lodash/lodash/issues/2625) but unfortunately I get the error below:
... app.component.html' . Error: ENOENT: no such file or directory, open
// uglify setting
new webpack.optimize.UglifyJsPlugin({
comments: false,
compress: {
warnings: false
},
output: {
ascii_only: true,
beautify: false,
}
})
Hopefully someone finds and a solution. The starter is not very useful if it can't be deployed...
We also have the same problem. When comment this code it is working in IIS Express/RELEASE mode but it's not solution. If publish - retrieving '
... app.component.html' . Error: ENOENT: no such file or directory, open
' Is it the problem in this plugin or something else?:
//new webpack.optimize.UglifyJsPlugin({
// compress: false,
// mangle: false
// }),
Seems like uglify is giving us problems, this is real strange... I’ll post back here when I know more!
Apologies everyone 😔
Any workaround for this? commenting out UglifyJsPlugin just left me with another error
Any workaround @MarkPieszak ?
So a few updates, I'm still looking into it, and there seems to be an issue with Uglify, but actually you can remove that (realistically) from the server build, as it doesn't get "loaded" (since it is used outside of the browser), so minifying it, doesn't benefit in any way.
So the other problem ENOENT: no such file or directory, open 'app.component.html' seems to be coming from angular2-template-loader not doing its thing. Since it should be inlining the template, since we're not trying to load it here.
I'll keep looking, just wanted to give an update!
problem with line 259 in main-server.js a="_A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd",u="-._A-Za-z0-9\xb7\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0300-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd"
I updated "webpack": "^3.8.1", "file-loader": "^1.1.5", "extract-text-webpack-plugin": "^3.0.2",
now uglify recognize ascii_only
so I can do
new webpack.optimize.UglifyJsPlugin({ output: { ascii_only: true, beautify: false, } }),
js files now CORRECT, no unicode strings
BUT error ENOENT: no such file or directory, open 'app.component.html' still exists
also on production we use
@ngtools/webpack - NOT angular2-template-loader
line 34 in webpack.config.js use: isDevBuild ? ['awesome-typescript-loader?silent=true', 'angular2-template-loader', 'angular2-router-loader'] : '@ngtools/webpack'