glsl-polyfill-loader
v1.0.4
Published
glsl polyfill webpack loader
Downloads
2
Readme
glsl-polyfill-loader
install
npm i raw-loader glsl-polyfill-loader -D
or
yarn global add raw-loader glsl-polyfill-loader -D
polyfill-list
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';