문제

Context

I cloned a basic node-browserify boilerplate project and got it up. I'm using coffee-script. Right now, I'm trying to add jadeify to the equation as follows:

bundle = browserify
    entry: __dirname + "/app/init.coffee"
    debug: true
    mount: "/app.js"
bundle.use jadeify __dirname + '/views'
app.use bundle

This is before I even attempt to use jadeify anywhere.

Issue

Everything works, until I add bundle.use(jadeify(__dirname + '/views')) as a middleware to browserify. Then I get the following error message in browser's console:

Uncaught ReferenceError: __require is not defined

According to the browser's console, the source of this message is /app.js.

Question

Why does this script fail with an error as soon as I try to add the jadeify middleware for browserify?

Motivation

I figured that it'll be more convenient to reuse server-side jade templates on client-side, so I'm ditching underscore templates in favor of jade. While doing my research, I came across this solution to a related question that suggests the use of jadeify. It seems doable, but something seems to be failing.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top