Skip to content

"<" in pug doesn't work #3973

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

Closed
puxxustc opened this issue Oct 18, 2016 · 6 comments
Closed

"<" in pug doesn't work #3973

puxxustc opened this issue Oct 18, 2016 · 6 comments
Labels

Comments

@puxxustc
Copy link

env

macOS 10.12.1 Beta
nodejs 6.8.1
vuejs 2.0.3

Steps to reproduce

init a test vue project with default options

vue init webpack test
cd test

edit src/components/Hello.vue

<template lang="pug">
div
  div(v-if!="0 < 0")
</template>

<script>
export default {
}
</script>

then run dev server

npm run dev

What is actually happening?

got error:


> [email protected] dev /Users/xiaoxiao/test
> node build/dev-server.js

Listening at http://localhost:8080

webpack: wait until bundle finished: /index.html
webpack built 65f1e5f2bb987f85bda4 in 2618ms
Hash: 65f1e5f2bb987f85bda4
Version: webpack 1.13.2
Time: 2618ms
 Asset    Size  Chunks       Chunk Names
app.js  867 kB       0       app

ERROR in ./src/components/Hello.vue
Module build failed: Error: Error parsing template:

< 0")
</template>

<script>
export default {
}
</script>

    at parseHTML (/Users/xiaoxiao/test/node_modules/vue-template-compiler/build.js:3434:13)
    at Object.parseComponent (/Users/xiaoxiao/test/node_modules/vue-template-compiler/build.js:5171:3)
    at module.exports (/Users/xiaoxiao/test/node_modules/vue-loader/lib/parser.js:15:21)
    at Object.module.exports (/Users/xiaoxiao/test/node_modules/vue-loader/lib/loader.js:145:15)
 @ ./~/babel-loader!./~/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue 7:13-42
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks       Chunk Names
    index.html  1.46 MB       0
webpack: bundle is now VALID.

description

Similar issue: #3731 . However, situations are not the same. Replace "<" with ">" won't trigger this error. It's not a bug of pug as the error occurs before pug was called. In fact, this error happens even if pug is not installed.

Thanks for your time to review this issue.

@posva
Copy link
Member

posva commented Oct 18, 2016

This is a problem with pug itself. Please refer to the other issues for some hints: https://github.com/vuejs/vue/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20pug%20
or open an issue on the pug repository

@posva posva closed this as completed Oct 18, 2016
@puxxustc
Copy link
Author

@posva As I mentioned:

It's not a bug of pug as the error occurs before pug was called. In fact, this error happens even if pug is not installed.

@LinusBorg
Copy link
Member

LinusBorg commented Oct 18, 2016

which version of vue-loader is installed?

@puxxustc
Copy link
Author

@puxxustc
Copy link
Author

This may be an issue related to https://github.com/vuejs/vue/blob/dev/src/compiler/parser/html-parser.js#L47 . Pug is not a xml-like templting engine, so it can contain anything like script tag and style tag. Without specific treat, "<" may break html-parser's parsing procedure.

@LinusBorg LinusBorg reopened this Oct 18, 2016
@LinusBorg
Copy link
Member

LinusBorg commented Oct 18, 2016

I think this should have been fixed in 2.0.3:

image

Seems like it wasn't

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

No branches or pull requests

3 participants