Comments (9)
Note: a quick-and-dirty change in karma-rollup-preprocessor/lib/Watcher.js
like this:
- this.emitter._fileList.changeFile(path, true)
+ this.emitter._fileList.changeFile(path.replace(/\\/g, '/'), true)
β¦makes it work on my system.
That would however break projects that actually use backslashes in file names on posix systems. Perhaps check the value of require('path').sep
instead of replacing unconditionally?
from karma-rollup-preprocessor.
Something like this?
const sep = require('path').sep
//...
this.emitter._fileList.changeFile(sep !== '/' ? path.replace(/\\/g, '/') : path, true)
from karma-rollup-preprocessor.
@jlmakes path.normalize might work here. Not at my computer, so cannot double check.
from karma-rollup-preprocessor.
Took a look, and my above comment with path.normalize
will not work.
Take a look instead at slash.
Convert Windows backslash paths to slash paths:
foo\\bar
βfoo/bar
from karma-rollup-preprocessor.
It's basically a wrapper around the same string replace:
// slash.js
'use strict';
module.exports = path => {
const isExtendedLengthPath = /^\\\\\?\\/.test(path);
const hasNonAscii = /[^\u0000-\u0080]+/.test(path);
if (isExtendedLengthPath || hasNonAscii) {
return path;
}
return path.replace(/\\/g, '/');
};
I understand testing for ASCII, but I had to search for "extended length paths":
https://stackoverflow.com/questions/21194530/what-does-mean-when-prepended-to-a-file-path
from karma-rollup-preprocessor.
I know, was just thinking that it could potentially handle the edge cases for you if they ever came up.
from karma-rollup-preprocessor.
I'm generally cautious of adding dependencies, but I'm not opposed to it. I just don't fully understand if those cases are overly defensive for Karma and Rollup. As in, will non-ASCII or extended length paths occur in a JavaScript code base, or the build process therein?
That would however break projects that actually use backslashes in file names on posix systems. β @spectras
This would still need to be addressed in the implementation. So, something like this?
const slash = require('slash')
const sep = require('path').sep
//...
this.emitter._fileList.changeFile(sep !== '/' ? slash(path) : path, true)
from karma-rollup-preprocessor.
Just want to point out that \u0000
does show up when certain rollup plugins are involved.
from karma-rollup-preprocessor.
Good news and bad news!
Bad news: 5668d68 does not work here.
Good news: the fix in it works.
- After seeing 5668d68 did not work, I tried 7.0.4, and I have the same problem in it.
- So I downgraded to 7.0.3 and backported the commit. This worked and I confirm it fixes the issue.
So, the fix works, but 7.0.4 introduced another issue. I'll open a separate topic.
from karma-rollup-preprocessor.
Related Issues (20)
- Rollup has moved output options within the config
- sourcemaps not working HOT 4
- Add support of array configs HOT 4
- Source Maps not Working HOT 1
- Watching doesn't start when debugging HOT 4
- Not compatible with the latest version of Rollup (v1.0.0) HOT 2
- TypeError: Cannot read property 'forEach' of undefined HOT 4
- dynamic imports give a 404 HOT 4
- dependencies are duplicated for each test file HOT 19
- Issues using babel-typescript and @types packages HOT 3
- Watching fails to process files HOT 6
- Missing options in examples HOT 2
- Warnings when used with Rollup >= 1.27.0
- There are hints when using plug-ins that introduce files HOT 1
- @rollup/plugin-multi-entry broken by #54 HOT 6
- #69 breaks configs with output.file HOT 1
- Watcher not working using TypeScript? HOT 13
- Watch mode overwrites the test file HOT 9
- New version containing fix for watch mode HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from karma-rollup-preprocessor.