thepassle / create-lit-app

Create LitHTML apps with no build configuration. (LitHTML/Redux/Webpack/Express)
https://create-lit-app.herokuapp.com
110 stars 10 forks source link

webpack build thoughts #2

Closed thescientist13 closed 6 years ago

thescientist13 commented 6 years ago

Introductions 👋

First off, very cool project! I say that with all the envy and respect of someone who wishes they had thought of the idea first 😄

webpack Feedback

I'm still getting more familiar with the build and development workflows for "vanilla JS" projects with webpack in my own side project, but I have a fair amount of webpack experience with frameworks like Angular, React and Vue.

This project (although for React) is probably my "best" public attempt at configuring webpack to date. Hopefully it may provide a useful reference / context for my general thoughts and approach.

In reviewing I came out with a few observations for your consideration:

Misc Feedback

Happy to make a PR if you're onboard with these changes! ✌️

thepassle commented 6 years ago

Hi Owen!

Thanks for your feedback/additional links, very interesting stuff. Im interested in your thoughts about the webpack stuff, i'd happily take a look at a PR if you think it can be improved. (Especially interested in the viability of babel-preset-env)

As for using express, it is a little overkill for what it's doing atm, but the point is to allow people to start quickly extending on this starter kit, and while I'd like to minimize some dependencies, the goal is not to have no dependencies at all. Also I feel like express is commonly recognized enough to warrant including it.

aadamsx commented 6 years ago

As for using express, it is a little overkill for what it's doing atm, but the point is to allow people to start quickly extending on this starter kit

I agree with this 100%. I really liked the fact that it had Express "built in", even with the extra config.

thescientist13 commented 6 years ago

Thanks for the feedback @thepassle and @aadamsx ! Looking forward to sharing.

thescientist13 commented 6 years ago

Hey @thepassle , here's where I've gotten so far in my efforts.

Overview

Here is a branch with my latest WIP of a simple Todo App using LitElement

Here is some documentation I've written that can provide some more info. Basically without targetting IE11, there are no issues. Not sure what kind of browser support you had in mind.

tl;dr

browserslist

> 1%
not op_mini all

babel

module.exports = {
  presets: ['@babel/preset-env'],

  plugins: [
    ['babel-plugin-transform-builtin-classes', {
      globals: ['LitElement']
    }]
  ]
};

PostCSS

module.exports = {
  plugins: {
    'postcss-cssnext': {},
    'cssnano': {}
  }
};

Polyfills

<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.0.2/custom-elements-es5-adapter.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.0.0/polyfill.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.0.2/webcomponents-bundle.js"></script>

Once i get all the browsers working, I would look to apply similar changes here.

Looking forward to your thoughts!

thepassle commented 6 years ago

Hey owen! Finally have some time to really dive into this. The setup/config you have looks great, very clean. Im really looking to get rid of some dependencies and overall trying to have the build configuration much more clean, with as little means as necessary.

My main concern is browser support, as of now CLA supports at least the latest 2 versions of all major browsers, though I think we should be able to get that up and running as well. I'll have more time to work on it this friday, i expect i'll have some more info by then.

thepassle commented 6 years ago

Fixed in d86159d3d360cfc62746b3459e230f6f7358b544

Thanks for the feedback! :)