Closed xc-smile closed 5 years ago
C:\Users\Administrator\Desktop\kukaApp-manage>npm run build
ant-design-pro@0.3.0 build C:\Users\Administrator\Desktop\kukaApp-manage roadhog build
Creating an optimized production build... Failed to compile.
13.038dc859.async.js from UglifyJs Unexpected token: operator (>) [13.038dc859.async.js:17783,43]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ant-design-pro@0.3.0 build: roadhog build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ant-design-pro@0.3.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2018-10-29T03_40_40_128Z-debug.log
I´ve the same issue while using Terser (instead of UglifyJs):
ERROR in live.adb5df7f81c66940af8e.js from Terser
SyntaxError: Unexpected token {
at new Function (
webpack: 4.25.1 swiper: 4.4.2 babel-loader: 8.04 babel/preset-env: 7.1.5 babel/core: 7.1.5 npm: 6.4.1 terser: 1.1.0
Uncommenting swiper or run build as dev (without compression), build succeded.
Same issue here with Sage 9
ERROR Failed to compile with 1 errors 1:04:43 PM
error
scripts/main_49441635.js from UglifyJs
Unexpected token: operator (>) [scripts/main_49441635.js:1,20043]
6 assets
error Command failed with exit code 2.
I'm using custom build feature from .esm.js file like this:
import { Swiper, Scrollbar, Autoplay } from 'swiper/dist/js/swiper.esm.js';
Swiper.use([Scrollbar, Autoplay]);
new Swiper(selector, options);
In case someone will google this as I did, in my case a solution was to prevent dom7
and swiper
from exclude in webpack config.
From sage webpack.config.js
:
{
test: /\.js$/,
exclude: [/node_modules(?![/|\\](bootstrap|foundation-sites))/],
use: [
{ loader: 'cache' },
{ loader: 'buble', options: { objectAssign: 'Object.assign' } },
],
},
Change to:
{
test: /\.js$/,
exclude: [/node_modules(?![/|\\](bootstrap|foundation-sites|dom7|swiper))/],
use: [
{ loader: 'cache' },
{ loader: 'buble', options: { objectAssign: 'Object.assign' } },
],
},
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed due to inactivity. If this issue is still actual, please, create the new one.
A file compression failure occurred, and the build succeeded when the introduction of swiper was commented out