add woff2 support
use es6 module
This commit is contained in:
@@ -9,7 +9,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
module.exports = {
|
||||
entry: {
|
||||
index: './src/fonteditor/index',
|
||||
// editor: './src/fonteditor/editor'
|
||||
editor: './src/fonteditor/editor'
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../dist'),
|
||||
@@ -22,27 +22,42 @@ module.exports = {
|
||||
resolve: {
|
||||
extensions: ['.js', '.jsx', '.json'],
|
||||
alias: {
|
||||
'css': path.resolve(__dirname, '../css'),
|
||||
'common': path.resolve(__dirname, '../src/common'),
|
||||
'graphics': path.resolve(__dirname, '../src/graphics'),
|
||||
'math': path.resolve(__dirname, '../src/math'),
|
||||
'editor': path.resolve(__dirname, '../src/editor'),
|
||||
'render': path.resolve(__dirname, '../src/render'),
|
||||
'fonteditor-core': path.resolve(__dirname, '../node_modules/fonteditor-core/src'),
|
||||
'JSZip': path.resolve(__dirname, '../dep/jszip')
|
||||
'JSZip$': path.resolve(__dirname, '../dep/jszip/jszip.min.js'),
|
||||
'inflate$': path.resolve(__dirname, '../dep/pako_inflate.min.js'),
|
||||
'deflate$': path.resolve(__dirname, '../dep/pako_deflate.min.js'),
|
||||
'paper$': path.resolve(__dirname, '../dep/paper-full.js'),
|
||||
'utpl$': path.resolve(__dirname, '../dep/utpl.min.js')
|
||||
}
|
||||
},
|
||||
externals: {
|
||||
jquery: 'window.jQuery',
|
||||
$: 'window.jQuery',
|
||||
utpl: 'window.utpl',
|
||||
paper: 'window.paper'
|
||||
$: 'window.jQuery'
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
title: 'index',
|
||||
filename: 'index.html',
|
||||
template: path.resolve(__dirname, '../index.tpl'),
|
||||
template: path.resolve(__dirname, '../index.tpl?zh-cn'),
|
||||
chunks: ['index']
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
title: 'index',
|
||||
filename: 'index-en.html',
|
||||
template: path.resolve(__dirname, '../index.tpl?en-us'),
|
||||
chunks: ['index']
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
title: 'editor',
|
||||
filename: 'editor.html',
|
||||
template: path.resolve(__dirname, '../editor.tpl'),
|
||||
chunks: ['editor']
|
||||
})
|
||||
],
|
||||
module: {
|
||||
@@ -56,22 +71,36 @@ module.exports = {
|
||||
loader: 'tpl-loader'
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
test: /\.lesstpl$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
'css-loader'
|
||||
'css-loader',
|
||||
'less-loader'
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
use: ['style-loader', 'css-loader', 'less-loader']
|
||||
},
|
||||
{
|
||||
test: /\.(png|svg|jpg|gif)$/,
|
||||
use: [
|
||||
'file-loader'
|
||||
{
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 1000
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.(woff|woff2|eot|ttf|otf|wasm)$/,
|
||||
use: [
|
||||
'file-loader'
|
||||
{
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 1000
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user