glsl-polyfill-loader

1.0.4 • Public • Published

glsl-polyfill-loader

install

npm i raw-loader glsl-polyfill-loader -D

or

yarn global add raw-loader glsl-polyfill-loader -D

polyfill-list

doc

usage

file.js

import glsl from './file.glsl';

webpack.config.js

// webpack.config.js
module.exports = {
  module: {
    rules: [
      {
        test: /\.glsl$/i,
        use: [
          'raw-loader',
          'glsl-polyfill-loader',
        ],
      },
    ],
  },
};

you also define options:

// webpack.config.js
module.exports = {
  module: {
    rules: [
      {
        test: /\.glsl$/i,
        use: [
          'raw-loader',
          ['glsl-polyfill-loader', {
            config: {
              // about polyfill `texture` and define options of polyfill `texture`
              'texture': {
                variableName: 'TEXTURE2D',
              },
            },
            disablePolyfill: ['xxx'],
          }],
        ],
      },
    ],
  },
};

you also can use glsl-module-loader with glslify-loader and glslify-module-loader:

// webpack.config.js
module.exports = {
  module: {
    rules: [
      {
        test: /\.glsl$/i,
        use: [
          'raw-loader',
          'glsl-polyfill-loader',
          'glslify-loader',
          'glsl-module-loader',
        ],
      },
    ],
  },
};

And run webpack via your preferred method.

Examples

project

Inline

import glsl from 'glsl-polyfill-loader!./utils.glsl';

Package Sidebar

Install

npm i glsl-polyfill-loader

Weekly Downloads

0

Version

1.0.4

License

none

Unpacked Size

6.16 kB

Total Files

6

Last publish

Collaborators

  • juln