Use webpack to copy olm.js
Rather than copying olm.js ourselves in package.json, get webpack to do it for us by declaring it as a second entry point.
This commit is contained in:
parent
e564d34ca8
commit
fcf683c8a7
3 changed files with 28 additions and 17 deletions
|
@ -3,6 +3,18 @@ var webpack = require('webpack');
|
|||
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
"bundle": "./src/vector/index.js",
|
||||
|
||||
// We ship olm.js as a separate lump of javascript. This makes it get
|
||||
// loaded via a separate <script/> tag in index.html (which loads it
|
||||
// into the browser global `Olm`), and define it as an external below.
|
||||
//
|
||||
// (we should probably make js-sdk load it asynchronously at some
|
||||
// point, so that it doesn't block the pageload, but that is a separate
|
||||
// problem)
|
||||
"olm": "olm/olm.js",
|
||||
},
|
||||
module: {
|
||||
preLoaders: [
|
||||
{ test: /\.js$/, loader: "source-map-loader" }
|
||||
|
@ -19,9 +31,15 @@ module.exports = {
|
|||
// there is no need for webpack to parse them - they can just be
|
||||
// included as-is.
|
||||
/highlight\.js\/lib\/languages/,
|
||||
|
||||
// olm takes ages for webpack to process, and it's already heavily
|
||||
// optimised, so there is little to gain by us uglifying it.
|
||||
/olm\/(javascript\/)?olm\.js$/,
|
||||
],
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, "vector"),
|
||||
filename: "[name].js",
|
||||
devtoolModuleFilenameTemplate: function(info) {
|
||||
// Reading input source maps gives only relative paths here for
|
||||
// everything. Until I figure out how to fix this, this is a
|
||||
|
@ -46,11 +64,6 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
externals: {
|
||||
// olm takes ages for webpack to process, and it's already heavily
|
||||
// optimised, so there is little to gain by us uglifying it. We
|
||||
// therefore use it via a separate <script/> tag in index.html (which
|
||||
// loads it into the browser global `Olm`), and reference it as an
|
||||
// external here.
|
||||
"olm": "Olm",
|
||||
},
|
||||
plugins: [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue