nolimits4web / swiper

Most modern mobile touch slider with hardware accelerated transitions
https://swiperjs.com
MIT License
40.02k stars 9.74k forks source link

Use the swiper ^ 4.4.1, cause the failure of the project build #2854

Closed xc-smile closed 5 years ago

xc-smile commented 6 years ago

A file compression failure occurred, and the build succeeded when the introduction of swiper was commented out

xc-smile commented 6 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

ITspirit commented 6 years ago

I´ve the same issue while using Terser (instead of UglifyJs):

ERROR in live.adb5df7f81c66940af8e.js from Terser SyntaxError: Unexpected token { at new Function () at module.exports (/var/lib/jenkins/workspace/node_modules/terser-webpack-plugin/dist/worker.js:14:15) at handle (/var/lib/jenkins/workspace/node_modules/worker-farm/lib/child/index.js:44:8) at process. (/var/lib/jenkins/workspace/node_modules/worker-farm/lib/child/index.js:51:3) at emitTwo (events.js:126:13) at process.emit (events.js:214:7) at emit (internal/child_process.js:762:12) at _combinedTickCallback (internal/process/next_tick.js:142:11) at process._tickCallback (internal/process/next_tick.js:181:9)

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.

dawidurbanski commented 5 years ago

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);
dawidurbanski commented 5 years ago

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' } },
  ],
},
stale[bot] commented 5 years ago

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.

stale[bot] commented 5 years ago

This issue has been automatically closed due to inactivity. If this issue is still actual, please, create the new one.