render.js instead of shady-render.jsshady-render.js by copy-pasting few lines of codeI'd like to see steps for rollup builds, as well.
via a "MODERN_TARGET" variable replaced by the bundler? so more things can be opt-out at the same time?
We should add this both to the Tools section as well as a link to those instructions from the Styling section.
For rollup, using `@plugin/rollup-alias', this shaves off a few bytes:
alias({
entries: [{
find: 'lit-html/lib/shady-render.js',
replacement: 'node_modules/lit-html/lit-html.js'
}]
}),
I just tried it on the little counter here and I have no improvements on lit-html-only or lit-element.
my setup looks like this
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import { terser } from 'rollup-plugin-terser';
import visualizer from 'rollup-plugin-visualizer';
import alias from '@rollup/plugin-alias';
import * as fs from 'fs';
import * as path from 'path';
function b(src, withdeps) {
return {
input: `download/${src}/dist/index.js`,
output: {
dir: `dist/${src}/bundle` + (withdeps ? '' : '-nodeps'),
format: 'esm',
sourcemap: true,
},
plugins: [
alias({
entries: [
{
find: 'lit-html/lib/shady-render.js',
replacement: 'node_modules/lit-html/lit-html.js',
},
],
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
withdeps ? resolve({ preferBuiltins: true }) : undefined,
...
@CaptainCodeman I just tried it on my project and it works great ;-)
Before:

After:

I haven't tested the output much yet...
Based on some experiments with a very trivial webpack setup, it appears that you can just use resolve.alias:
resolve: {
alias: {
'lit-html/lib/shady-render.js': path.resolve(__dirname, './node_modules/lit-html/lit-html.js')
}
},
Not sure if I'm abusing "alias" here--webpack experts feel free to chime in :D.
Most helpful comment
Based on some experiments with a very trivial webpack setup, it appears that you can just use
resolve.alias:Not sure if I'm abusing "alias" here--webpack experts feel free to chime in :D.