提交 79308870 编写于 作者: T Tristan Valcke

Revert "Remove rollup.unit.config.js file and implement conditional...

Revert "Remove rollup.unit.config.js file and implement conditional environment in rollup.config.js (Available env are "production" and "test" for the moment)"

This reverts commit e2b02763.
上级 50bbb049
......@@ -24,66 +24,21 @@ function glsl() {
}
export default {
entry: (function () {
var env = process.env.BUILD;
if( env === 'production' ) {
return 'src/Three.js';
} else if( env === 'test' ){
return 'test/Three.Unit.js';
} else {
console.error("Invalid BUILD environment variable: " + env);
return null;
}
})(),
entry: 'src/Three.js',
indent: '\t',
plugins: [
glsl()
],
// sourceMap: true,
targets: (function () {
var env = process.env.BUILD;
if( env === 'production' ) {
return [
{
format: 'umd',
moduleName: 'THREE',
dest: 'build/three.js'
},
{
format: 'es',
dest: 'build/three.module.js'
}
];
} else if( env === 'test' ){
return [
{
format: 'umd',
moduleName: 'THREE',
dest: 'test/unit/three.unit.js'
}
];
} else {
console.error("Invalid BUILD environment variable: " + env);
return null;
targets: [
{
format: 'umd',
moduleName: 'THREE',
dest: 'build/three.js'
},
{
format: 'es',
dest: 'build/three.module.js'
}
})()
]
};
function glsl() {
return {
transform( code, id ) {
if ( /\.glsl$/.test( id ) === false ) return;
var transformedCode = 'export default ' + JSON.stringify(
code
.replace( /[ \t]*\/\/.*\n/g, '' )
.replace( /[ \t]*\/\*[\s\S]*?\*\//g, '' )
.replace( /\n{2,}/g, '\n' )
) + ';';
return {
code: transformedCode,
map: { mappings: '' }
};
}
};
}
export default {
entry: 'test/Three.Unit.js',
indent: '\t',
plugins: [
glsl()
],
// sourceMap: true,
targets: [
{
format: 'umd',
moduleName: 'THREE',
dest: 'test/unit/three.unit.js'
}
]
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册