index.js
import { Math as tMath } from './lib/three.modules.js'
console.log(tMath.DEG2RAD);
When I use gulp + rollup to bundle the index.js
, It merge the all three.module.js to the build.js file NOT ONLY the Math
section.
gulpfile.js
var gulp = require('gulp'),
rollup = require('gulp-better-rollup'),
babel = require('rollup-plugin-babel'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify');
gulp.task('bundle', function() {
var isRelease = process.argv.indexOf('-r') > -1;
return gulp.src('./src/index.js')
.pipe(rollup({
plugins: [
// babel({
// exclude: 'node_modules/**',
// presets: ['es2015-rollup']
// })
]
}, 'iife'))
.pipe(rename('build.js'))
.pipe(gulp.dest('./build/'))
So how to config this?
The issue is that Rollup can't shake Object.AssignProperties or Object.DefineProperties, which are used a lot throughout the three codebase.
This is not something that can be fixed at the moment. See this Rollup issue.
Most helpful comment
The issue is that Rollup can't shake Object.AssignProperties or Object.DefineProperties, which are used a lot throughout the three codebase.
This is not something that can be fixed at the moment. See this Rollup issue.