npm install
npm run webpack
Last active
June 5, 2018 07:55
-
-
Save dimitrilahaye/45aa99a3ec7f9fcea9528531f9c93d86 to your computer and use it in GitHub Desktop.
Simple webpack configuration for export / import
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<title>My app !</title> | |
</head> | |
<body> | |
<script src="dist/bundle.js"></script> | |
</body> | |
</html> |
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": "modules", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "npm run webpack", | |
"webpack": "webpack -d --watch" | |
}, | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"@babel/core": "^7.0.0-beta.49", | |
"@babel/preset-env": "^7.0.0-beta.49", | |
"babel-core": "^6.26.3", | |
"babel-loader": "^8.0.0-beta.3", | |
"babel-preset-env": "^1.7.0", | |
"node-libs-browser": "^2.1.0", | |
"webpack": "^4.10.2", | |
"webpack-cli": "^3.0.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
let path = require('path'); | |
module.exports = { | |
entry: ['./src/app.js'], // entry point of the application | |
output: { | |
filename: './bundle.js' // will build the app into ./dist/bundle.js | |
}, | |
module: { | |
rules: [ | |
{ | |
loader: 'babel-loader', | |
test: path.join(__dirname, 'app'), | |
query: { | |
presets: 'env' | |
} | |
} | |
] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment