pdf-to-markdown/webpack.config.js

107 lines
3.0 KiB
JavaScript
Raw Normal View History

2017-01-06 20:49:37 +01:00
var path = require('path');
var webpack = require('webpack');
2016-11-11 19:47:20 +01:00
var HtmlWebpackPlugin = require('html-webpack-plugin');
2017-01-06 20:49:37 +01:00
var CopyWebpackPlugin = require('copy-webpack-plugin');
var SOURCE_DIR = path.resolve(__dirname, 'src');
var JAVASCRIPT_DIR = SOURCE_DIR + '/javascript';
2017-01-06 20:49:37 +01:00
var BUILD_DIR = path.resolve(__dirname, 'build');
var NODEMODULES_DIR = path.resolve(__dirname, 'node_modules');
2016-11-11 19:47:20 +01:00
module.exports = {
2024-03-18 23:55:06 +01:00
mode: 'development',
context: SOURCE_DIR,
resolve: {
modules: [
path.resolve(JAVASCRIPT_DIR),
path.resolve('./node_modules')
]
},
entry: {
app: './javascript/index.jsx'
},
2016-11-11 19:47:20 +01:00
output: {
2017-01-06 20:49:37 +01:00
path: BUILD_DIR,
filename: 'bundle.js'
2016-11-11 19:47:20 +01:00
},
module: {
rules: [
2016-11-11 19:47:20 +01:00
{
// Ask webpack to check: If this file ends with .js, then apply some transforms
2017-01-06 20:49:37 +01:00
test: /\.jsx?$/,
loader: 'babel-loader',
2017-01-06 20:49:37 +01:00
include: [JAVASCRIPT_DIR],
2016-11-11 19:47:20 +01:00
},
{
2017-01-06 20:49:37 +01:00
test: /\.css$/,
use: ['style-loader', 'css-loader']
2016-11-12 00:08:06 +01:00
},
2016-11-11 19:47:20 +01:00
{
test: /\.png$/,
use: ["url-loader?limit=100000"]
2016-11-11 19:47:20 +01:00
},
2017-01-06 20:49:37 +01:00
{
test: /\.jpg$/,
loader: "file-loader"
},
{
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
use: ['url-loader?limit=10000&mimetype=application/font-woff']
2017-01-06 20:49:37 +01:00
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
use: ['url-loader?limit=10000&mimetype=application/octet-stream']
2017-01-06 20:49:37 +01:00
},
{
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
use: ['file-loader']
2017-01-06 20:49:37 +01:00
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
use: ['url-loader?limit=10000&mimetype=image/svg+xml']
2017-01-06 20:49:37 +01:00
}
2016-11-11 19:47:20 +01:00
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'index.html'
2017-01-06 20:49:37 +01:00
}),
2017-01-09 21:24:12 +01:00
new webpack.DefinePlugin({
'process.env': {
'version': JSON.stringify(process.env.npm_package_version),
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development')
}
}),
new CopyWebpackPlugin(
2017-01-06 20:49:37 +01:00
{
patterns: [
{
from: NODEMODULES_DIR + '/pdfjs-dist/build/pdf.worker.js',
to: 'bundle.worker.js'
},
]
}
),
new CopyWebpackPlugin(
2017-05-02 19:19:57 +02:00
{
patterns: [
{
from: NODEMODULES_DIR + '/pdfjs-dist/cmaps',
to: 'cmaps'
},
]
}
),
new CopyWebpackPlugin(
{
patterns: [
{
from: 'favicons',
to: 'favicons'
},
]
}
)
2016-11-11 19:47:20 +01:00
]
}