tbom
Version:
Taobao Open Platform Modules
68 lines (65 loc) • 1.6 kB
JavaScript
;
process.noDeprecation = true;
const path = require('path');
const utils = require('./utils');
const webpack = require('webpack');
const RaxPlugin = require('rax-webpack-plugin');
const AmdPlugin = require('./plugins/webpackAmdPlugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const WatchMissingNodeModulesPlugin = require('watch-missing-node-modules-webpack-plugin');
module.exports = {
entry: {
index: path.join(__dirname, '../src/index.js')
},
output: {
libraryTarget: 'amd',
path: path.join(__dirname, '../'),
pathinfo: false,
filename: '[name].js'
},
resolve: {
extensions: ['.js', '.json', '.jsx'],
alias: {
'react': 'rax'
}
},
externals: ['rax'],
plugins: [
new RaxPlugin({
target: 'amd',
externalBuiltinModules: true
}),
new AmdPlugin({
name: require('../package.json').name
}),
new UglifyJSPlugin(),
new CaseSensitivePathsPlugin(),
new WatchMissingNodeModulesPlugin(path.join(__dirname, '../node_modules'))
],
module: {
loaders: [{
test: /\.jsx?$/,
loader: 'babel-loader',
query: {
presets: [
require.resolve('babel-preset-es2015'),
require.resolve('babel-preset-rax')
],
}
},
{
test: /\.css$/,
loader: 'stylesheet-loader'
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.(png|jpe?g|gif)$/i,
loader: 'image-source-loader'
}
]
}
};