Closed douggr closed 5 years ago
Hacking a bit further, I think that is something wrong with preactjs-templates/default. Not sure though.
I was able to get it up and running with preactjs-templates/typescript. Since this is a new and small project, I will give it a try. BUT(!), if you have any clue about the original post, please let me know ;)
Cheers.
P.S.: Great transformer! I loved the __macro thingie :)
@douggr
I have added an example for preactjs-templates/default
below.
https://github.com/bluewings/pug-as-jsx-loader/tree/master/examples/preact-default
In preact.config.js
, you need to set babel preset for the .pug
file.
and npm install babel-preset-react --save-dev
https://github.com/bluewings/pug-as-jsx-loader/blob/b74ad079b8fd8c80d1ad487203c14834b1591a77/examples/preact-default/preact.config.js#L12-L26
If you are using Babel 7 or higher, try the options below
loader: require.resolve('babel-loader'),
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
},
Enjoy using the following Pug template!, Thank you! https://github.com/bluewings/pug-as-jsx-loader/tree/b74ad079b8fd8c80d1ad487203c14834b1591a77/examples/preact-default/src/routes/home
Hello! Well, this is awkward.
This is funny, because if I load the transpiled file instead, it works like a charm.
Options:
Output
index.pug
index.js
Transpiled file: