mirror of
https://github.com/jzillmann/pdf-to-markdown.git
synced 2024-11-21 23:33:31 +01:00
97 lines
3.1 KiB
JavaScript
97 lines
3.1 KiB
JavaScript
var path = require('path');
|
|
var webpack = require('webpack');
|
|
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
var CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
|
|
var SOURCE_DIR = path.resolve(__dirname, 'src');
|
|
var BUILD_DIR = path.resolve(__dirname, 'build');
|
|
var NODEMODULES_DIR = path.resolve(__dirname, 'node_modules');
|
|
var JAVASCRIPT_DIR = SOURCE_DIR + '/javascript';
|
|
|
|
module.exports = {
|
|
entry: JAVASCRIPT_DIR + '/index.jsx',
|
|
output: {
|
|
path: BUILD_DIR,
|
|
filename: 'bundle.js'
|
|
},
|
|
resolve: {
|
|
extensions: ['', '.js'],
|
|
fallback: [path.join(__dirname, '../node_modules')],
|
|
alias: {
|
|
'src': path.resolve(__dirname, '../src'),
|
|
'assets': path.resolve(__dirname, '../src/assets'),
|
|
'components': path.resolve(__dirname, '../src/components')
|
|
}
|
|
},
|
|
resolveLoader: {
|
|
fallback: [path.join(__dirname, '../node_modules')]
|
|
},
|
|
module: {
|
|
// Special compilation rules
|
|
loaders: [
|
|
{
|
|
// Ask webpack to check: If this file ends with .js, then apply some transforms
|
|
test: /\.jsx?$/,
|
|
// Transform it with babel
|
|
loader: 'babel',
|
|
// don't transform node_modules folder (which don't need to be compiled)
|
|
include: [JAVASCRIPT_DIR],
|
|
query: {
|
|
plugins: ['transform-runtime'],
|
|
presets: ['es2015', 'stage-0', 'react'],
|
|
}
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
loader: "style-loader!css-loader"
|
|
},
|
|
{
|
|
test: /\.png$/,
|
|
loader: "url-loader?limit=100000"
|
|
},
|
|
{
|
|
test: /\.jpg$/,
|
|
loader: "file-loader"
|
|
},
|
|
{
|
|
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
|
|
loader: 'url?limit=10000&mimetype=application/font-woff'
|
|
},
|
|
{
|
|
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
|
|
loader: 'url?limit=10000&mimetype=application/octet-stream'
|
|
},
|
|
{
|
|
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
|
loader: 'file'
|
|
},
|
|
{
|
|
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
|
|
loader: 'url?limit=10000&mimetype=image/svg+xml'
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
template: SOURCE_DIR + '/index.html'
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
'process.env': {
|
|
'version': JSON.stringify(process.env.npm_package_version),
|
|
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development')
|
|
}
|
|
}),
|
|
new CopyWebpackPlugin([
|
|
{
|
|
from: NODEMODULES_DIR + '/pdfjs-dist/build/pdf.worker.js',
|
|
to: 'bundle.worker.js'
|
|
},
|
|
]),
|
|
new CopyWebpackPlugin([
|
|
{
|
|
from: SOURCE_DIR + '/favicons',
|
|
to: 'favicons'
|
|
},
|
|
])
|
|
]
|
|
} |