2018-10-23 19:32:42 +08:00
|
|
|
const webpack = require('webpack');
|
|
|
|
const resolve = require('path').resolve;
|
|
|
|
const pkg = require('./package.json');
|
|
|
|
module.exports = {
|
|
|
|
devtool: 'cheap-source-map',
|
|
|
|
entry: {
|
2019-02-27 15:33:38 +08:00
|
|
|
l7: './src/index.js',
|
|
|
|
three: './src/core/three.js'
|
2018-10-23 19:32:42 +08:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
filename: '[name].js',
|
|
|
|
library: 'L7',
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
path: resolve(__dirname, 'build/')
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
// exclude: /(node_modules|bower_components)/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
babelrc: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.glsl$/,
|
|
|
|
use: {
|
|
|
|
loader: 'glsl-shaders-loader'
|
|
|
|
}
|
|
|
|
},
|
2019-01-20 20:44:49 +08:00
|
|
|
{
|
|
|
|
test: /\.worker\.js$/,
|
|
|
|
use: {
|
|
|
|
loader: 'worker-loader',
|
|
|
|
options: {
|
|
|
|
inline: true,
|
|
|
|
fallback: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2018-10-23 19:32:42 +08:00
|
|
|
{
|
|
|
|
test: /global\.js$/,
|
|
|
|
use: {
|
|
|
|
loader: 'string-replace-loader',
|
|
|
|
options: {
|
|
|
|
search: '____L7_VERSION____',
|
|
|
|
replace: pkg.version
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.NoEmitOnErrorsPlugin(),
|
2018-10-30 11:22:18 +08:00
|
|
|
new webpack.optimize.AggressiveMergingPlugin()
|
2018-10-23 19:32:42 +08:00
|
|
|
]
|
|
|
|
};
|