Skip to content

Instantly share code, notes, and snippets.

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/app.js',
target: 'web',
node: {
fs: 'empty'
},
output: {
@awareness481
awareness481 / error.txt
Last active July 31, 2018 08:19
webpack error
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration has an unknown property 'default'. These properties are valid:
object { mode?, amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, externals?, loader?, module?, name?, node?, output?, optimization?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, serve?, stats?, target?, watch?, watchOptions? }
For typos: please correct them.
For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.
Loaders should be updated to allow passing options via loader options in module.rules.
Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
plugins: [
new webpack.LoaderOptionsPlugin({
// test: /\.xxx$/, // may apply this only for some modules
@awareness481
awareness481 / webpack.common.js
Created July 31, 2018 08:05
webpack.prod.js
const path = require('path');
module.exports = {
entry: './src/app.js',
target: 'web',
node: {
fs: 'empty'
},
output: {
path: path.join(__dirname, 'public'),
import React from 'react';
export default class Action extends React.Component {
constructor(props) {
super(props);
this.state = {
val: ''
}
import React from 'react';
export default class Action extends React.Component {
constructor(props) {
super(props);
this.handleAction = this.handleAction.bind(this);
}
handleAction (e) {
{
"name": "tests",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha **/*.test.js",
"test-watch": "nodemon --exec \"npm test\""
},
"author": "",
[
{
"key": "\\frac{num}{den}",
"description": "Create a fraction. The num stands for numerator and den for denominator"
},
{
"key": "\\dfrac{num}{den}",
"description": "Fraction in display mode"
},
{
[
{
"key": " ",
"desc": " \n"
},
{
"key": "\\* ",
"desc": "erminates a line, but disallows a pagebreak.\n"
},
{
[
{
"key": "",
"desc": " \\\\* terminates a line, but disallows a pagebreak.\n"
},
{
"key": "",
"desc": "\n"
},
{
@awareness481
awareness481 / .json
Created June 20, 2017 16:15
Early version for testing
[
{
"keyword": "factorial",
"syntax": "\\frac{numerator}{denominator}"
},
{
"keyword": "binomial",
"syntax": "\\binom{n}{k}"
},
{