g6/webpack.config.js

59 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-06-05 23:58:10 +08:00
const webpack = require('webpack');
2020-01-06 10:46:03 +08:00
// eslint-disable-next-line prefer-destructuring
2018-06-05 23:58:10 +08:00
const resolve = require('path').resolve;
2019-03-20 15:06:36 +08:00
2018-06-05 23:58:10 +08:00
module.exports = {
2019-12-02 19:58:02 +08:00
entry: {
2020-01-03 17:31:09 +08:00
g6: './src/index.ts'
2019-12-02 19:58:02 +08:00
},
2018-06-05 23:58:10 +08:00
output: {
2019-12-02 19:58:02 +08:00
filename: '[name].min.js',
library: 'G6',
2018-06-05 23:58:10 +08:00
libraryTarget: 'umd',
2020-02-07 17:56:51 +08:00
libraryExport: 'default',
path: resolve(process.cwd(), 'dist/'),
2018-06-05 23:58:10 +08:00
},
2019-12-02 19:58:02 +08:00
resolve: {
// Add `.ts` as a resolvable extension.
extensions: ['.ts', '.js'],
2018-06-05 23:58:10 +08:00
},
module: {
rules: [
2019-12-31 12:05:28 +08:00
{
test: /\.worker\.ts$/,
exclude: /(node_modules)/,
2019-12-31 12:05:28 +08:00
use: [
{
loader: 'worker-loader',
options: {
inline: true,
fallback: false,
name: 'g6Layout.worker.js',
},
},
],
},
2018-06-05 23:58:10 +08:00
{
test: /\.ts$/,
2018-06-05 23:58:10 +08:00
use: {
2019-12-02 19:58:02 +08:00
loader: 'babel-loader',
2018-06-05 23:58:10 +08:00
options: {
babelrc: true,
},
},
2018-07-22 18:02:53 +08:00
},
{
2019-12-02 19:58:02 +08:00
test: /\.ts$/,
2019-11-18 02:47:44 +08:00
use: {
2019-12-02 19:58:02 +08:00
loader: 'ts-loader',
2019-11-18 02:47:44 +08:00
options: {
transpileOnly: true,
},
},
},
],
2018-06-05 23:58:10 +08:00
},
plugins: [new webpack.NoEmitOnErrorsPlugin(), new webpack.optimize.AggressiveMergingPlugin()],
devtool: 'source-map',
2018-06-05 23:58:10 +08:00
};