JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 516838
  • Score
    100M100P100Q177673F
  • License MIT

Complete set of constants as specified in the WebGL, WebGL2 and extension spec.

Package Exports

  • webgl-constants

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (webgl-constants) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

WebGL constants

npm version

Complete set of constants as specified in the WebGL, WebGL2 and extension spec.

All constants have their original names prefixed with GL_ in order to namespace the constants and were directly ported from the documentation on the Mozilla Developer Network.

Usage

In order to effectively tree-shake the defined constants webgl-constants is exported as a ES2015 module (import / export). This means that you will likely have to include it in your transpiliation build workflow. The following example does so in Webpack 3 in the webpack.config.js file using babel-preset-env, babel-core and babel-loader.

const config = {
    // ...,
    
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules\/(?!(webgl-constants)\/).*/,
                loader: 'babel-loader?cacheDirectory=true',
                options: {
                    presets: [
                        ['env', {
                            modules: false,
                            useBuiltIns: true,
                            targets: {
                                browsers: [
                                    '> 5%',
                                    'last 2 versions',
                                    'not ie <= 11',
                                    'ios_saf >= 10.2',
                                ],
                            },
                        }],
                    ],
                },
            },
        ],
    },
}

module.exports = config;