Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

babel --watch does initial compile but ignores changes when --extensions is missing #10270

Open
russelldavis opened this issue Jul 26, 2019 · 3 comments

Comments

@russelldavis
Copy link

commented Jul 26, 2019

Bug Report

  1. Create a typscript file foo.ts
  2. Run babel foo.ts --out-file foo.js --watch --verbose
  3. Make a change to foo.ts

Current Behavior
Babel runs an initial compile, but does not react to any changes in the file.

Expected behavior/code
Babel should recompile the file when it changes.

If you add --extensions ".ts" to the command line, babel will properly recompile when the file changes. However, since an exact filename has been given on the command line, the --extensions option shouldn't be needed.

.babelrc

{
    "presets": [
        "@babel/env",
        "@babel/typescript"
    ]
}

Environment

  • Babel version(s): v7.5.5
  • Node/npm version: Node 10.16.0 / npm 6.9.0
  • OS: macOS Mojave 10.14.6
  • Monorepo: no
  • How you are using Babel: cli
@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented Jul 26, 2019

Hey @russelldavis! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

@JLHwung JLHwung added pkg: cli and removed i: needs triage labels Jul 30, 2019

@RyanEwen

This comment has been minimized.

Copy link

commented Jul 30, 2019

This doesn't seem to work for me either, even if I add --extensions '.js' :(

{
    "name": "business-system",
    "version": "1.0.0",
    "scripts": {
        "build": "babel . --out-dir babeljs --ignore 'node_modules','babeljs','3rdparty' --watch"
    },
    "devDependencies": {
        "@babel/cli": "^7.5.5",
        "@babel/core": "^7.5.5",
        "@babel/preset-env": "^7.5.5",
        "@babel/runtime": "^7.5.5"
    },
    "dependencies": {
        "@babel/polyfill": "^7.4.4"
    },
    "babel": {
        "sourceType": "script",
        "sourceMaps": true,
        "minified": true,
        "presets": [
            ["@babel/env", {"targets": "last 2 years, not dead"}]
        ]
    }
}

As a side note, I can't get the ignore setting to work from down in the babel section either.

EDIT: sourceMaps doesn't work there either :/

@RyanEwen

This comment has been minimized.

Copy link

commented Jul 30, 2019

Scratch that, it actually does work for me, but nothing appears in the log as files are updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.