Comments (7)
maybe you have corrupted modules? try removing node_modules folder and do npm install again
from blendid.
After a bit of testing, I determined that this error occurs if I do not have underscore
installed as node_module
on it's own. If I perform a checkout of this repo, then immediately run npm install
, followed by gulp production
, the error occurs. It seems very unlikely that these two steps would result in corrupt modules (I also ran npm cache clean
before installing this repo). If I run npm install -D underscore
, and then run gulp production
, the project builds with no errors. On the other hand, if I do not install underscore
as it's own module, but instead replace this line in the config.js:
require: ['jquery', 'underscore']
with:
require: ['jquery', 'backbone/node_modules/underscore']
the build completes successfully.
So, am I doing something else wrong with regard to the loading of underscore
? Because, for me, it appears that I either need to have underscore
installed as it's own module (e.g., do not rely on underscore
within backbone
module dependencies), or I have to explicitly specify the path to underscore
within the backbone
dependencies, when specifying the require
-ed assets.
I referenced this during my troubleshooting: https://github.com/substack/node-browserify#brequirefile-opts
I should also note that it appears that listing underscore
in the browser
section of package.json
makes no difference. I removed the underscore
reference from package.json
, and also tried every variation of the backbone > underscore
reference that I could think of, and it made no difference. Additionally, I shim-ed underscore
in the browserify-shim
section, also to no avail.
from blendid.
Yeah, I saw this happen to a friend at work, but I couldn't replicate it on my machine. Might have something to do with minor version differences. I'll definitely look into it.
Your require: ['jquery', 'backbone/node_modules/underscore']
solution seems like a good one to me. That whole backbone underscore mess is only in this repo to call out a weird edge case where if you listed underscore
as a normal dependency, you'd end up with two copies of underscore in your compiled bundle since Backbone is weird and comes with it.
from blendid.
Thanks for the reply. I've run my starter kit (which borrows liberally from your examples here - thanks!!!) on several Macs and Windows machines, and everything is cool as long as I use backbone/node_modules/underscore
in the require param array, so I'm going to stick with that for now. The main thing is that I know that it works. Thanks again for all your efforts putting your repo together. It has been immensely helpful.
from blendid.
👍
from blendid.
Was able to reproduce it after upgrading node and npm, killing my node_modules folder and running npm cache clean
. Pushed up the fix you suggested with a note linking to this issue. Thanks!
Eventually I need to remove that backbone/underscore example. I think it's more confusing than helpful at this point. Maybe move a note about that edge case into the wiki instead.
from blendid.
Got this resolved by fixing the path of underscore in packages.json:
"underscore": "./node_modules/backbone/node_modules/underscore",
from blendid.
Related Issues (20)
- watch task will not compile more than 48 html files HOT 5
- Removing "comments" from public/html files HOT 1
- xlink:href being deprecated in SVG
- Additional Tasks information HOT 4
- Build issue: UglifyJs - Unexpected token: name (context)
- Build issue: UglifyJs - Unexpected token: name (context) HOT 5
- Fonts aren't copied over on build HOT 1
- additionalTasks access rev-manifest HOT 4
- Not bundle jquery in production HOT 1
- Current project status HOT 4
- 4.5.0 release not available through npm/yarn HOT 1
- Failed to mount component: template or render function not defined HOT 1
- upgrade to gulp 4
- empty prebuild and postbuild configs must be `null`/`false`, not `[]`. change this behavior?
- html watch task does not notice changes to files added after Blendid was started
- wrong generation of path for js-files in rev-manifest on windows HOT 1
- Configuration for swiper to work
- The engine "node" is incompatible with this module HOT 3
- 4.5.3 release not available through npm HOT 1
- ERROR in bundle.js from UglifyJs Unexpected token: name (ChangeDesc) [bundle.js:2900,6]
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 blendid.