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

Don’t always add "defaultIgnorePatterns" #1543

Closed
5 of 10 tasks
rluba opened this issue Apr 24, 2018 · 10 comments
Closed
5 of 10 tasks

Don’t always add "defaultIgnorePatterns" #1543

rluba opened this issue Apr 24, 2018 · 10 comments

Comments

@rluba
Copy link

rluba commented Apr 24, 2018

Issue details

browser-sync introduced a breaking change in v2.22.0: It added a list of defaultIgnorePatterns that are not only default, but always ignored.

We are often developing with symlinked packages (via npm link/bower link). We intentionally watch certain files in node_modules and bower_components to ease working across package boundaries. This broke in v2.22.0 since these files are now always ignored. There’s no way to disable these "default" ignore patterns—they are unconditionally merged with any ignore patterns defined by the user.

Please specify which version of Browsersync, node and npm you're running

  • Browsersync [v2.23.7]
  • Node [v8.9.1]
  • Npm [v5.8.0]

Affected platforms

  • linux
  • windows
  • OS X
  • freebsd
  • solaris
  • other (please specify which)

(But it will probably affect the others as well…)

Browsersync use-case

  • API
  • Gulp
  • Grunt
  • CLI

(But it will probably affect the others as well…)

@shakyShane
Copy link
Contributor

@rluba Hi!

This was not technically a breaking change, since it was introduced only when the new 'watch' option is used - although I can see why it appears to be.

The simplest solution for you, is to remove watch: true from your configuration, and instead specifiy the files you want to watch (this is how Browsersync always worked before the addition of watch)

// before
browserSync.init({
  server: "./app",
  watch: true
}}

// after
browserSync.init({
  server: "./app",
  files: [
      "./app",
      "node_modules/some/dir",
      "bower_components" 
  ]
}}

or to just watch everything

browserSync.init({
  server: "./app",
  files: ["."]
}}

@shakyShane
Copy link
Contributor

if (!incoming.get("watch")) {
return incoming;
}

@rluba
Copy link
Author

rluba commented Apr 24, 2018

Hi @shakyShane,

that’s what I initially expected, but we didn’t provide the watch option initially (since it’s new). We just noticed our watches breaking when upgrading past v2.21.0. I had a look at the doc, saw the new watch option (and it’s default, false) and tried setting it – it makes no difference.

Our usage looks like this:

            const server = browserSync.create('App');
            server.init(files, {
                startPath: '/index.html',
                server: {
                    baseDir: baseDirs,
                    middleware: proxy(config) // a partial HTTP proxy, doesn’t affect this issue
                },
                open: false,
                ghostMode: false
            }, callback);

with

baseDirs = [ 'build/.tmp', 'app' ];
files = [
    'app/src/**/*.html',
    <some files benath node_modules or bower_components>
    'build/.tmp/**/*' 
];

Touching any files in app or build/.tmp triggers a refresh, but nothing happens when we touch any of the files in bower_components.

The exact same configuration works when downgrading to v2.21.0 and is broken since v2.22.0, whether you add watch: true or not.

@shakyShane
Copy link
Contributor

@rluba thanks for the detail

In that case it does seem like a bug, I'll investigate asap!

:)

@shakyShane
Copy link
Contributor

Now that 2.24.0 is out, I'll be getting to this next :)

@shakyShane
Copy link
Contributor

@rluba I've found the bug, I'll release a fix this evening :)

@rluba
Copy link
Author

rluba commented May 2, 2018

Thank you for your support, I really appreciate it.

@shakyShane
Copy link
Contributor

shakyShane commented May 2, 2018

@rluba I just published a release candidate - could you try it on your projects and let me know if it works :)

I was able to reproduce in both unit & integration tests, so I'm confident - but since you raised the bug I'd appreciate the verification

Please try browser-sync@2.24.3-rc1

npm install browser-sync@rc

or

yarn add browser-sync@rc

shakyShane added a commit that referenced this issue May 3, 2018
fix: Don’t always add "defaultIgnorePatterns" - fixes #1543
@shakyShane
Copy link
Contributor

Fixed in browser-sync@2.24.3

@rluba
Copy link
Author

rluba commented May 7, 2018

It works again. Thank you! ✌️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants