Skip to content

Instantly share code, notes, and snippets.

@april
Created October 25, 2018 21:38
Show Gist options
  • Save april/3922e25bf740fa23ece8478a48a9bd1a to your computer and use it in GitHub Desktop.
Save april/3922e25bf740fa23ece8478a48a9bd1a to your computer and use it in GitHub Desktop.
ERROR in ./src/background_scripts/httpObservatory.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/april/Source/security-report-card/src/background_scripts/httpObservatory.js: Unexpected token (45:17)
43 | 'bar': 'baz'
44 | };
> 45 | const foobar = ...foo;
const CopyWebpackPlugin = require('copy-webpack-plugin');
const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
const path = require('path');
const webpack = require('webpack');
const production = process.env.NODE_ENV === 'production';
module.exports = {
output: {
path: path.resolve(__dirname, '..', 'build'),
filename: '[name].js'
},
entry: {
'background': path.resolve(__dirname, '..', 'src', 'background_scripts', 'entry.js'),
'popup/popup': path.resolve(__dirname, '..', 'src', 'popup', 'popup.js')
},
mode: production ? 'production' : 'development',
devtool: production ? undefined : 'source-map',
module: {
rules: [
{
test: /\.js$/,
include: path.resolve(__dirname, '..', 'src'),
use: [{
loader: 'babel-loader',
options: {
babelrc: false,
presets: [
['@babel/preset-env', {
'targets': {
'firefox': 57
}
}]
],
plugins: [
'@babel/plugin-proposal-object-rest-spread'
]
}
}]
}
]
},
plugins: [
new CopyWebpackPlugin([
{
from: 'src/manifest.json'
},
{
from: 'LICENSE.md'
},
{
from: 'src/popup/*.html',
to: 'popup/',
flatten: true
},
{
from: 'src/icons/*.svg',
to: 'icons/',
flatten: true
}
]),
new LicenseWebpackPlugin(
{
pattern: /.*/,
outputFilename: '[name].license.txt'
}
)
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment