Giter Site home page Giter Site logo

app-scripts-react uses the babel cli for typescript instead of plugin-babel, and sourcemaps are not generated about create-snowpack-app HOT 6 CLOSED

fredkschott avatar fredkschott commented on August 9, 2024
app-scripts-react uses the babel cli for typescript instead of plugin-babel, and sourcemaps are not generated

from create-snowpack-app.

Comments (6)

ervwalter avatar ervwalter commented on August 9, 2024 3

I think sourcemap support is important for the unbundled development flows specifically for things like Typescript where, even though it's not bundled, the source code you are typing is being transformed before it's sent to the browser. It's really not practical to debug the transpiled Javascript without sourcemaps.

from create-snowpack-app.

Ciantic avatar Ciantic commented on August 9, 2024 1

I modified the babel.config.json like this:

{
  "extends": "@snowpack/app-scripts-react/babel.config.json",
  "sourceMaps": "inline"
}

But the source maps are not in sync. If I add debugger; command it is not on right line number.

In my opinion the source maps should be enabled by default when doing:

npx create-snowpack-app new-dir2 --template @snowpack/app-template-react-typescript

Why would the template exist if it didn't include the basic minimal setup? Source maps surely are one of the first things you need when debugging. (IMO the developer experience should be made so good that you can just debug from VSCode too, the ideal end-goal.)

from create-snowpack-app.

FredKSchott avatar FredKSchott commented on August 9, 2024 1

Yup, our sourcemap support is limited right now, due to the fact that they provide less value in unbundled development. See previous discussion here: https://www.pika.dev/npm/snowpack/discuss/221#comment-6691

Right now we don't really support source maps outside of the bundle step. The idea is that because each build is single-file, no one file is ever that different from its source.

We will eventually support this for those who still want it, and if anyone else is willing to own the implementation of this then I'd consider pushing it up the roadmap and tacking it now. But my time is limited, it's a hard problem to solve.

from create-snowpack-app.

FredKSchott avatar FredKSchott commented on August 9, 2024

since it's just the babel CLI, you can enable them by adding --source-maps to the build script: https://babeljs.io/docs/en/babel-cli#compile-with-source-maps

Since your config gets merged with with the @snowpack/app-scripts-react config, you would just define a script with the same name in your own snowpack.config.js to overwrite the one provided by default.

from create-snowpack-app.

FredKSchott avatar FredKSchott commented on August 9, 2024

I think that we use the CLI because we needed to have the --config-file ${bundledConfig} support. But, eventually the plugin should support this.

from create-snowpack-app.

FredKSchott avatar FredKSchott commented on August 9, 2024

Snowpack now handles JS/JSX/TS/JSX compilation internally, by default. You can still add Babel if you'd like (with or without --source-maps) but CSA apps now ship without an additional Babel dependency by default.

from create-snowpack-app.

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.