mapseed/platform

Add an ES6 transpiler to our build process

goldpbear opened this issue · 7 comments

The immediate use case is to support this module, but having a transpiler in place will enable us to start using ES6 features throughout the app.

zmbc commented

@zmbc -- do you think it's important to have the transpiler in place in development, or only in the production build? I guess if we don't have it in development that's akin to requiring all contributors to have ES6-compliant browsers, which might not be such a big deal, but I'm not sure.

We should put it in the webpack config and use it for both dev and prod.

It should be as simple as adding something like this to our webpack config:

  module: {
    rules: [
      {
        test: /\.(js)$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'babel-loader',
            query: {
              cacheDirectory: true
            }
          }
        ]
      }
    ]
  },

I would recommend TypeScript, It uses ES6 features and even some of the future EcmaScript proposals, it's a powerful tool with data type checking.

zmbc commented

I like TypeScript as well.

@goldpbear why do you think we need ES6 for that module? Looks like it works just fine in plnkr without any transpiler.

I guess the minified version strips out es6 features? I was going off the instructions on the npm page for including the module via webpack.

zmbc commented

I think "Webpack/ES6" just means webpack or ES6 import strategies, which we wouldn't use anyway. We would put a script tag here. I think that would work. If there are no CDNs for it, and I couldn't immediately find any, we could self-host.