HTML echo error, NPM run build error, HTML path error

Direct NPM run build will report an error as follows:

ERROR in static/js/0.94510c9d26edb4b687ab.js from UglifyJs

Unexpected token: punc (() [./~/time-formater/lib/timeformater.js:21,0][static/js/0.94510c9d26edb4b687ab.js:41797,10]

The main problem is that when uglifyjs compresses the code, it can’t compress the code of ES6, so it should be converted to Es5 with bable first

The time formater library is ES6 and has not been converted.


npm install –save–dev [email protected]

Under webpack. Base. Conf, the

Include: [resolve (‘src ‘), resolve (‘test’)] is modified to

include: [resolve(‘src’), resolve(‘test’),resolve(‘node_ modules/time-formater’)]

The wrong path of js.css referenced by index.html is found in config/index.js

Set to assetspublicpath: ‘. /’,

Read More: