I have BABEL_DISABLE_CACHE=1 set and I've tried setting cacheDirectory: false and neither option helps (as expected since the comment is missing from the output).
.babelrc contents:
{
"presets": [
[
"env", {
"targets": {
"browsers": [
"last 2 Chrome versions"
]
},
"modules": "umd"
}]
],
"plugins": [
[
"babel-plugin-inline-import", {
"extensions": [
".css"
]
}
],
[
"transform-incremental-dom", {
"moduleSource": "incremental-dom"
}
],
["transform-class-properties"]
],
"env": {
"test": {
"plugins": [
["istanbul", {
"exclude": [
"tests/**/*"
]
}]
]
},
"production": {
"presets": ["babili"]
}
}
}
webpack.config.js:
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: './docs/index.js',
devtool: 'inline-source-map',
output: {
path: __dirname + '/docs/generated',
filename: 'docs.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
'babel-inline-import-loader',
'babel-loader'
]
}
]
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'docs/template.html'
})
]
}
input code:
import Component from '../../component'
import styles from './styles.css'
customElements.define('wc-button', class WcButton extends Component {
renderCss () {
super.renderCss()
return (
<style>
{styles}
</style>
)
}
render () {
return <button><slot /></button>
}
})
relevant output:
const styles = 'button {\n background: red;\n}\n';
customElements.define('wc-button', class WcButton extends _component2.default {
renderCss() {
super.renderCss();
(0, _incrementalDom.elementOpen)('style');
_renderArbitrary(styles);
return (0, _incrementalDom.elementClose)('style');
}
render() {
(0, _incrementalDom.elementOpen)('button');
(0, _incrementalDom.elementVoid)('slot');
return (0, _incrementalDom.elementClose)('button');
}
});
I have
BABEL_DISABLE_CACHE=1set and I've tried settingcacheDirectory: falseand neither option helps (as expected since the comment is missing from the output)..babelrc contents:
{ "presets": [ [ "env", { "targets": { "browsers": [ "last 2 Chrome versions" ] }, "modules": "umd" }] ], "plugins": [ [ "babel-plugin-inline-import", { "extensions": [ ".css" ] } ], [ "transform-incremental-dom", { "moduleSource": "incremental-dom" } ], ["transform-class-properties"] ], "env": { "test": { "plugins": [ ["istanbul", { "exclude": [ "tests/**/*" ] }] ] }, "production": { "presets": ["babili"] } } }webpack.config.js:
input code:
relevant output: