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.
Solution:
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:
- Vscode HTML file auto supplement HTML skeleton failure
- Has HTML webpack plugin been installed, or error: cannot find module ‘HTML webpack plugin’
- NPM run build failed to package err! Missing script: build
- NPM run build error solution
- MarkDownPad 2 HTML Reading Error
- [HTML] Python extracts HTML text to TXT
- Refused to apply style from <URL> because its MIME type (‘text/html‘) is not a supported stylesheet
- Python: crawler handles strings of XML and HTML
- Solution for HTML5 page embedded app not displaying normally
- NPX webpack cannot find module’html webpack plugin’a bug causes headache
- How to use JavaScript in HTML
- Uncaught Error: THREE.OBJLoader : unexpected line: “DOCTYPE HTML” [solved]
- Solve the problem of Tomcat console and HTML garbled
- Docker machine install syntax error near unexpected token ‘newline’! DOCTYPE HTML problem resolution
- How to center the box horizontally and vertically in HTML
- How to use dangerously set inner HTML in react
- HTML using title attribute to display text with mouse hover
- Httprunner v3. X generates HTML report in assure format
- Error in pyinstall package Python program: jinja2.exceptions.templatenotfound: Chart_ Solution to component.html
- NPM run serve reported an error “NPM err! Missing script: start”