|
@@ -24,21 +24,66 @@ function glsl() {
|
|
|
}
|
|
|
|
|
|
export default {
|
|
|
- entry: 'src/Three.js',
|
|
|
+
|
|
|
+ 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;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ })(),
|
|
|
indent: '\t',
|
|
|
plugins: [
|
|
|
glsl()
|
|
|
],
|
|
|
// sourceMap: true,
|
|
|
- targets: [
|
|
|
- {
|
|
|
- format: 'umd',
|
|
|
- moduleName: 'THREE',
|
|
|
- dest: 'build/three.js'
|
|
|
- },
|
|
|
- {
|
|
|
- format: 'es',
|
|
|
- dest: 'build/three.module.js'
|
|
|
+ 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;
|
|
|
+
|
|
|
}
|
|
|
- ]
|
|
|
+
|
|
|
+ })()
|
|
|
};
|