add webpack.config
This commit is contained in:
parent
fe8cfcbe47
commit
fe4b1bf362
4 changed files with 54 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
/node_modules/
|
/node_modules/
|
||||||
|
/build/
|
||||||
|
|
3
src/index.js
Normal file
3
src/index.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import * as Module from './module';
|
||||||
|
|
||||||
|
Module.initialize()
|
18
src/module.js
Normal file
18
src/module.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
const initialize = (url) => {
|
||||||
|
let p = document.createElement("p");
|
||||||
|
p.textContent = "Hello Vim Vixen";
|
||||||
|
p.style.position = 'fixed';
|
||||||
|
p.style.right = '0';
|
||||||
|
p.style.bottom = '0';
|
||||||
|
p.style.padding = '0rem .5rem';
|
||||||
|
p.style.margin = '0';
|
||||||
|
p.style.backgroundColor = 'lightgray';
|
||||||
|
p.style.border = 'gray';
|
||||||
|
p.style.boxShadow = '0 0 2px gray inset';
|
||||||
|
p.style.borderRadius = '3px';
|
||||||
|
p.style.fontFamily = 'monospace';
|
||||||
|
|
||||||
|
document.body.append(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { initialize };
|
32
webpack.config.js
Normal file
32
webpack.config.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
|
const src = path.resolve(__dirname, 'src');
|
||||||
|
const dist = path.resolve(__dirname, 'build');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: {
|
||||||
|
index: path.join(src, 'index.js')
|
||||||
|
},
|
||||||
|
|
||||||
|
output: {
|
||||||
|
path: dist,
|
||||||
|
filename: '[name].js'
|
||||||
|
},
|
||||||
|
|
||||||
|
module: {
|
||||||
|
loaders: [
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
loader: 'babel-loader',
|
||||||
|
query: {
|
||||||
|
presets: [ 'es2015' ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
resolve: {
|
||||||
|
extensions: [ '.js' ]
|
||||||
|
}
|
||||||
|
};
|
Reference in a new issue