Skip to content
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

get error when pass function to pug #397

Closed
dxcqcv opened this issue Aug 3, 2016 · 7 comments
Closed

get error when pass function to pug #397

dxcqcv opened this issue Aug 3, 2016 · 7 comments

Comments

@dxcqcv
Copy link

dxcqcv commented Aug 3, 2016

I wanna pass a function to pug, and using pug-html-loader to load pug,

in webpack.config.js

  {
    test:/\.pug$/,
    exclude: ['/node_modules/'],
    loader: 'pug-html-loader',
    query: {
      data: {bb:function(str){return str + '444';},aa:'666'},
      pretty: true
    }
  },

in pug file

p!= data.aa
p!= data.bb(data.aa)

use data.aa is OK, but get error when use data.bb

Html Webpack Plugin:
  Error: Child compilation failed:
  Module build failed: TypeError: data.bb is not a function




  - TypeError: data.bb is not a function

  - compiler.js:76 
    [resume]/[html-webpack-plugin]/lib/compiler.js:76:16

  - Compiler.js:214 Compiler.
    [lib]/[webpack]/lib/Compiler.js:214:10

  - Compiler.js:403 
    [lib]/[webpack]/lib/Compiler.js:403:12

  - Tapable.js:67 Compiler.next
    [lib]/[webpack]/[tapable]/lib/Tapable.js:67:11

  - CachePlugin.js:40 Compiler.
    [lib]/[webpack]/lib/CachePlugin.js:40:4

  - Tapable.js:71 Compiler.applyPluginsAsync
    [lib]/[webpack]/[tapable]/lib/Tapable.js:71:13

  - Compiler.js:400 Compiler.
    [lib]/[webpack]/lib/Compiler.js:400:9

  - Compilation.js:577 Compilation.
    [lib]/[webpack]/lib/Compilation.js:577:13

  - Tapable.js:60 Compilation.applyPluginsAsync
    [lib]/[webpack]/[tapable]/lib/Tapable.js:60:69

  - Compilation.js:572 Compilation.
    [lib]/[webpack]/lib/Compilation.js:572:10

  - Tapable.js:60 Compilation.applyPluginsAsync
    [lib]/[webpack]/[tapable]/lib/Tapable.js:60:69

  - Compilation.js:567 Compilation.
    [lib]/[webpack]/lib/Compilation.js:567:9

  - Tapable.js:60 Compilation.applyPluginsAsync
    [lib]/[webpack]/[tapable]/lib/Tapable.js:60:69

  - Compilation.js:563 Compilation.
    [lib]/[webpack]/lib/Compilation.js:563:8

  - Tapable.js:60 Compilation.applyPluginsAsync
    [lib]/[webpack]/[tapable]/lib/Tapable.js:60:69

  - Compilation.js:525 Compilation.seal
    [lib]/[webpack]/lib/Compilation.js:525:7
@jantimon
Copy link
Owner

jantimon commented Aug 3, 2016

Does data.aa work?

@dxcqcv
Copy link
Author

dxcqcv commented Aug 3, 2016

it works, @jantimon

@jantimon
Copy link
Owner

jantimon commented Aug 3, 2016

Does the pug loader support functions?

@dxcqcv
Copy link
Author

dxcqcv commented Aug 3, 2016

I'm not sure, but I only get this error message in Html Webpack Plugin, right? so I think the problem is in here, and not to report issues to pug-html-loader

@jantimon
Copy link
Owner

jantimon commented Aug 3, 2016

I don't know the pug-html-loader well enough to help you with this.. I doubt that this is an html-webpack-plugin issue

@dxcqcv
Copy link
Author

dxcqcv commented Aug 3, 2016

I also submit an issue to pug-html-loader, I really wanna solve this bug, thx for your help.

@lock
Copy link

lock bot commented May 31, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants