Comments (16)
@Bockit Could post the stack trace with grunt browserify --stack
? That helps track down where the error is originating from.
from grunt-browserify.
Fatal error: Arguments to path.resolve must be strings
TypeError: Arguments to path.resolve must be strings
at Object.exports.resolve (path.js:313:15)
at Object.exports.relative (path.js:371:18)
at Stream._vars.__filename (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/insert-module-globals/index.js:32:31)
at /Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/insert-module-globals/index.js:86:40
at Array.forEach (native)
at Stream.write (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/insert-module-globals/index.js:84:18)
at Stream.stream.write (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/through/index.js:25:11)
at Stream.ondata (stream.js:51:26)
at Stream.EventEmitter.emit (events.js:95:17)
at drain (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/through/index.js:36:16)
at Stream.stream.queue.stream.push (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/through/index.js:45:5)
at Stream.<anonymous> (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/index.js:191:19)
at Stream.stream.write (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/through/index.js:26:11)
at Stream.ondata (stream.js:51:26)
at Stream.EventEmitter.emit (events.js:95:17)
at drain (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/through/index.js:36:16)
at Stream.stream.queue.stream.push (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/through/index.js:45:5)
at Stream.write (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/index.js:231:18)
at Stream.stream.write (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/through/index.js:26:11)
at Stream.ondata (stream.js:51:26)
at Stream.EventEmitter.emit (events.js:95:17)
at drain (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/through/index.js:36:16)
at Stream.stream.queue.stream.push (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/through/index.js:45:5)
at done (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/module-deps/index.js:193:20)
at parseDeps (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/module-deps/index.js:182:32)
at done (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/module-deps/index.js:141:13)
at ap (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/module-deps/index.js:127:42)
at ConcatStream.cb (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/module-deps/index.js:134:21)
at ConcatStream.end (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/concat-stream/index.js:43:21)
at Stream.onend (stream.js:79:10)
at Stream.EventEmitter.emit (events.js:117:20)
at drain (/Users/work/Documents/project/node_modules/coffeeify/node_modules/through/index.js:33:23)
at Stream.stream.queue.stream.push (/Users/work/Documents/project/node_modules/coffeeify/node_modules/through/index.js:41:5)
at /Users/work/Documents/project/node_modules/coffeeify/index.js:82:20
at compile (/Users/work/Documents/project/node_modules/coffeeify/index.js:64:5)
at Stream.end (/Users/work/Documents/project/node_modules/coffeeify/index.js:79:9)
at _end (/Users/work/Documents/project/node_modules/coffeeify/node_modules/through/index.js:61:9)
at Stream.stream.end (/Users/work/Documents/project/node_modules/coffeeify/node_modules/through/index.js:70:5)
at /Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/module-deps/index.js:136:19
at nr (/Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/module-deps/index.js:218:13)
at /Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/module-deps/node_modules/resolve/lib/async.js:43:21
at /Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/module-deps/node_modules/resolve/lib/async.js:116:35
at /Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/module-deps/node_modules/resolve/lib/async.js:90:39
at /Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/module-deps/node_modules/resolve/lib/async.js:59:30
at /Users/work/Documents/project/node_modules/grunt-browserify/node_modules/browserify/node_modules/module-deps/node_modules/resolve/lib/async.js:18:18
at Object.oncomplete (fs.js:107:15)
from grunt-browserify.
For what it's worth, my node_modules/grunt-browserify/node_modules/browserify/index.js has two console.logs in it from when I was trying to debug a different config which had alias and ignore. This may knock the line numbers in browserify/index.js a little bit.
In browserify.prototype.deps
, starts at line 222
function write (row) {
console.log(row.id)
self.emit('dep', row);
if (row.id === emptyModulePath) {
row.source = '';
}
...
if (self._external[row.id]) {
console.log('externalising ' + row.id)
return;
}
Ends at line 244
We only see the first console.log appear before the error occurs:
/Users/work/Documents/project/src/app/settings.coffee
from grunt-browserify.
Looks like an issue with browserify-shim. I believe 2.0.7 fixes it. Can you test with that version and see if it works? If so I'll go ahead and update the package.json.
from grunt-browserify.
Having same issue with [email protected]
and [email protected]
...
from grunt-browserify.
@nicolashery can you provide a simplified version of your config so I can try to figure out what's going on? Thanks!
from grunt-browserify.
@jmreidy How's this: https://github.com/nicolashery/test-grunt-browserify-globals
Thanks!
from grunt-browserify.
@nicolashery, thanks, this is perfect.
@thlorenz, any thoughts on this? The issue only seems to come up when using browserify-shim...
from grunt-browserify.
@nicolashery, could you allow me to push to that repo?
from grunt-browserify.
@jmreidy I recently fixed some issues with browserify shim.
Not sure if the grunt plugin and/or @Bockit, @nicolashery are using the latest version.
Since browserify-shim just creates a transform and auto-requires files with browserify, I'm not sure what else it could break that affects the bundling process.
from grunt-browserify.
@jmreidy added you as collaborator on that repo
from grunt-browserify.
@thlorenz it looks like if you pass insertGlobals: true
as an option to browserify, then the path.resolve
bug manifests itself again. detectGlobals
works fine.
@nicolashery, @Bockit: switch out insertGlobals for detectGlobals and you'll be fine.
from grunt-browserify.
Sorry for not being able to test what you asked for, I was away for a week. Sadly detect globals are the opposite of what I want (trying to speed up build times for my dev environment) but I understand there's not much you can do about it. Thanks for your help!
from grunt-browserify.
@Bockit The best approach would be to isolate the shims to their own browserify:vendor
subtask, and expose those for consumption externally. That way, you only have to build your big vendor libraries once, which should significantly speed up times. There's an example of this approach in the examples folder.
from grunt-browserify.
Thanks for the tip @jmreidy! Careful though if using source maps with Browserify during development, concatenating vendor.js
and app.js
messes it up.
What works for me is:
During development, use source maps (debug: true
option of grunt-browserify
) and use separate script tags:
<script type="text/javascript" src="vendor.js"></script>
<script type="text/javascript" src="app.js"></script>
For production, no source maps, concatenate vendor.js
and app.js
to main.js
, minify, and use a single script tag:
<script type="text/javascript" src="main.js"></script>
from grunt-browserify.
@nicolashery Really helpful advice. I'm going to add this to the docs.
from grunt-browserify.
Related Issues (20)
- messy code with Chinese characters in source maps HOT 2
- Edge Issue with stream-http HOT 2
- please tag new releases HOT 1
- support using browserify-lite as an option HOT 6
- Multiple Browserify tasks HOT 4
- npm install ! has error!
- Using alias miss the export.module = library HOT 2
- browserifyOptions mapping unclear HOT 2
- Unable to specify plugin/transform order HOT 1
- does not work with uglifyify
- next release? HOT 9
- cacheFile not working HOT 16
- How to use browserify-hmr plugin for multi bundles
- update examples
- browser unable to load latest node version HOT 1
- 5.2.1 Release for Browserify Update HOT 6
- Is it possible to have multiple 'standalone':s?
- Outputted bundle is not correct. Example case inside:
- grunt-browserify isn't compatible with Node.js v12 HOT 5
- Old version dependecy async: 1.5.2 version causing High vulnerability (npm audit)
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 grunt-browserify.