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

webpack build thoughts #2

Closed
thescientist13 opened this issue Aug 5, 2018 · 6 comments
Closed

webpack build thoughts #2

thescientist13 opened this issue Aug 5, 2018 · 6 comments

Comments

@thescientist13
Copy link

thescientist13 commented Aug 5, 2018

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
Copy link
Owner

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
Copy link

aadamsx commented Aug 8, 2018

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
Copy link
Author

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

@thescientist13
Copy link
Author

thescientist13 commented Sep 3, 2018

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

  • Using webpack + Browserslist + Babel and PostCSS + preset-env to transpile only the code that is needed based on a CanIUse query
  • Works in IE11!
    todo-app-working-ie11-omg
  • Still need to look into an issue with Chrome having an error when using lit-element and transpiled ES5. Something to do with this and properties I think.
    chrome-error-code-on-add-todo
    chrome-error-on-add-todo
  • Still need to test Edge
  • Pulling in polyfills using CDN (still considering CopyWebpackPlugin though, or maybe polyfill.io)

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
Copy link
Owner

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
Copy link
Owner

Fixed in d86159d

Thanks for the feedback! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants