1.0.4 • Published 7 months ago

glsl-polyfill-loader v1.0.4

Weekly downloads
-
License
-
Repository
github
Last release
7 months ago

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';
1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.0

7 months ago