Git Product home page Git Product logo

Comments (2)

chilloutman avatar chilloutman commented on August 12, 2024

The bundle.js is a "Webpack Universal Module", which is why there are no exposed globals. You can consume it with Webpack; and I believe that CommonJS require should also work.

I used it with Webpack / create-react-app and an import like this:

import * as prettier from 'prettier-standalone'

I'm not actively working with it, but you can see it working on illuminatejs.com, where it's used to format the code you type in, in addition to the main de-obfuscation thing it does.

As for the size, there is not much that can be improved. If you do use Webpack, prettier-standalone can be minified along with the rest of your bundle. For example, the main JS bundle for IlluminateJS, which includes a bunch of additional dependencies, comes in at less than 4 MB, which is still a lot, but less than the 5.5 MB bundle.js.

prettier has numerous dependencies, some of which are quite large. It's safe to say that using prettier in the browser is not ideal. It's also explicitly not a supported use-case. But hey, if you're just doing some research, like I was, or trying to build something cool but not-so-serious, this should work fine.

from prettier-standalone.

bvaughn avatar bvaughn commented on August 12, 2024

Thanks for the explanation! 😄 The name "standalone" suggested that might potentially support a UMD context so I thought I'd ask for clarification. 😄

prettier has numerous dependencies, some of which are quite large. It's safe to say that using prettier in the browser is not ideal. It's also explicitly not a supported use-case. But hey, if you're just doing some research, like I was, or trying to build something cool but not-so-serious, this should work fine.

I was initially looking to use this module for the upcoming Babel REPL where it would be lazy-loaded only if requested. I ended up using bundle.run/prettier instead so I'll close this issue.

from prettier-standalone.

Related Issues (2)

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.