mapseed / platform

Mapseed is a simple, beautiful way to collect information and tell geographic stories.
http://mapseed.org
GNU General Public License v3.0
88 stars 36 forks source link

Add an ES6 transpiler to our build process #690

Closed goldpbear closed 7 years ago

goldpbear commented 7 years ago

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 7 years ago

Agreed. Let's use this.

goldpbear commented 7 years ago

@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.

modulitos commented 7 years ago

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
            }
          }
        ]
      }
    ]
  },
Bilal-io commented 7 years ago

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 7 years ago

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.

goldpbear commented 7 years ago

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 7 years ago

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.