Giter Site home page Giter Site logo

Comments (13)

ataylor32 avatar ataylor32 commented on July 18, 2024 2

I forked that official Vue demo app,
vue-hackernews-2.0, created a branch called vue-cropperjs-issue-39, and made one commit.

Here are the steps you can go through to reproduce the problem on your own computer:

  1. Clone https://github.com/ataylor32/vue-hackernews-2.0.git

  2. Check out the vue-cropperjs-issue-39 branch

  3. Run npm ci

  4. Start the site in development mode by running npm run dev

  5. Go to http://localhost:8080/top in your browser and click on one of the comments links. You will be navigated to a comments page and if you look below the header, you'll see a file input. Browse for a GIF, JPG, or PNG and you'll see that vue-cropperjs is working fine. Now refresh the page (i.e. try to get server-side rendering to render the page) and it will break. Stop the site with Ctrl+C.

  6. Start the site in production mode by running npm run build && npm start and then repeat the previous step and you'll see that it behaves the same in production mode

Thank you!

from vue-cropperjs.

ataylor32 avatar ataylor32 commented on July 18, 2024 1

I'm running into this too. @Agontuk Would you be willing to reopen this issue? I would really like to get this working. This is what I'm getting:

/var/www/example.com/node_modules/cropperjs/dist/cropper.css:11
.cropper-container {
^

SyntaxError: Unexpected token .
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/var/www/example.com/node_modules/vue-cropperjs/dist/VueCropper.js:15:1)
error during render : /profile/
/var/www/example.com/node_modules/cropperjs/dist/cropper.css:11
.cropper-container {
^

SyntaxError: Unexpected token .
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/var/www/example.com/node_modules/vue-cropperjs/dist/VueCropper.js:15:1)

from vue-cropperjs.

Agontuk avatar Agontuk commented on July 18, 2024 1

@ataylor32 , sorry for the late response. New version 4.0.0 is published and should work on SSR now. Note that default css import is removed now so you have to import it in your file where you're using it. Readme has been updated.

from vue-cropperjs.

wfe8006 avatar wfe8006 commented on July 18, 2024

I end up using another library.

from vue-cropperjs.

kapvik avatar kapvik commented on July 18, 2024

I end up using another library.

Have same issue, what library you use now?

from vue-cropperjs.

wfe8006 avatar wfe8006 commented on July 18, 2024

I end up using another library.

Have same issue, what library you use now?

I use https://github.com/zhanziyang/vue-croppa, it's fairly easy to configure. Check it out.

from vue-cropperjs.

kapvik avatar kapvik commented on July 18, 2024

I end up using another library.

Have same issue, what library you use now?

I use https://github.com/zhanziyang/vue-croppa, it's fairly easy to configure. Check it out.

Thanks

from vue-cropperjs.

koibi2 avatar koibi2 commented on July 18, 2024

我刚刚解决了!(环境是: electron-vue。)
node_modules/vue-cropperjs/dist/VueCropper.js 注释这一行:
image

然后在 VUE 页面的 style 引入即可。

<style lang="scss">
@import "cropper.css";

p.s:估计这是JS引用CSS报错导致的。肯定有更好的解决方法,如webpack配置。
有好的方法。欢迎下面留言。

from vue-cropperjs.

Agontuk avatar Agontuk commented on July 18, 2024

@ataylor32 , seems like your setup is not recognizing the css syntax. Can you check if you can enable css loader so that it can parse css ?

from vue-cropperjs.

ataylor32 avatar ataylor32 commented on July 18, 2024

@Agontuk I'm using this:

{
  test: /\.css$/,
  loader: ['vue-style-loader', 'css-loader'],
},

This is only an issue with server-side rendering. My project is based on an official Vue demo app,
vue-hackernews-2.0.

from vue-cropperjs.

Agontuk avatar Agontuk commented on July 18, 2024

Can you give me a example repo so that I can reproduce the issue on my end ? I have yet to try out the server side rendering in vue so don't know the exact issue.

from vue-cropperjs.

Agontuk avatar Agontuk commented on July 18, 2024

Thanks for the detailed steps, I'm checking out the vue ssr guide to get familiar with it. Then I'll check on the issue.

from vue-cropperjs.

ataylor32 avatar ataylor32 commented on July 18, 2024

No problem. Thanks for fixing it! It works for me now.

from vue-cropperjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.