Last active
December 11, 2018 03:27
-
-
Save andrewfinnell/9bc597e5637482cac0324a9a14d1e6f4 to your computer and use it in GitHub Desktop.
Simple webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "testwebpack", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"build": "webpack" | |
}, | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"@babel/core": "^7.2.0", | |
"@babel/plugin-proposal-object-rest-spread": "^7.2.0", | |
"@babel/plugin-transform-modules-commonjs": "^7.2.0", | |
"@babel/preset-env": "^7.2.0", | |
"@babel/preset-es2015": "^7.0.0-beta.53", | |
"babel-loader": "^8.0.4", | |
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", | |
"babel-preset-es2015": "^6.24.1", | |
"babel-preset-react": "^6.24.1", | |
"jshint": "^2.9.7", | |
"jshint-loader": "^0.8.4", | |
"node-libs-browser": "^2.1.0", | |
"webpack": "^4.27.1", | |
"webpack-cli": "^3.1.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>com.github.eirslett</groupId> | |
<artifactId>frontend-maven-plugin</artifactId> | |
<version>1.6</version> | |
<executions> | |
<execution> | |
<id>install node and npm</id> | |
<phase>generate-resources</phase> | |
<goals> | |
<goal>install-node-and-npm</goal> | |
</goals> | |
<configuration> | |
<nodeVersion>v8.11.4</nodeVersion> | |
</configuration> | |
</execution> | |
<execution> | |
<id>npm install</id> | |
<phase>generate-resources</phase> | |
<goals> | |
<goal>npm</goal> | |
</goals> | |
<configuration> | |
<arguments>install</arguments> | |
</configuration> | |
</execution> | |
<execution> | |
<id>npm build</id> | |
<phase>generate-resources</phase> | |
<goals> | |
<goal>npm</goal> | |
</goals> | |
<configuration> | |
<arguments>build</arguments> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
entry: ["./src/main/webapp/app.js"], | |
output: { | |
filename: "../src/main/webapp/bundle.js" | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.m?js$/, | |
exclude: /(node_modules)/, | |
use: { | |
loader: 'babel-loader', | |
options: { | |
presets: [ | |
['@babel/preset-env', { | |
targets: { | |
"chrome": "58", | |
"ie": "11" | |
}}] | |
], | |
plugins: ['@babel/plugin-proposal-object-rest-spread','transform-es2015-modules-commonjs', '@babel/plugin-transform-modules-commonjs'] | |
} | |
} | |
} | |
] | |
}, | |
resolve: { | |
extensions: ['.js', '.es6'] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment