prepack/webpack.config.js
Sebastian Markbåge 111af14f61 Refactor the public API in a similar style to Babel API (#469)
* Refactor the public API

This refactors the public Node API to mimic the
[Babel API](http://babeljs.io/docs/usage/api/). This is a bit more
idiomatic than "run CLI" or instantiate the full serializer object.

I'm passing a single options object instead of individual arguments. This
is a bit more managable as the option list grows.

The prepack-node file is what is exposed in Node which has a file system
API. Both synchronous and asynchronous forms. prepack-standalone is a
module for environments without access to the file system such as browsers.
I configure this to be exposed by default for such environments.

That way we can also use this in the webpack build so that our own repl
on the website can just use this public API.

* Throw an error when serialization fails

This lets any compiler flow to terminate properly by default but the error
can safely be ignored if we've already printed error messages for it such
as in the CLI.

Turn internalDebug error messages off by default but allow it to be
configured.

* Added missing realm options

Not yet exposed in the cli but available through the API.
2017-04-27 00:30:00 -07:00

29 lines
677 B
JavaScript

/**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
const path = require('path');
const webpack = require('webpack');
const WebpackConfig = {
entry: "./",
output: {
path: path.join(__dirname),
filename: "prepack.min.js",
library: 'Prepack',
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
sourceMap: false,
})
],
};
module.exports = WebpackConfig;