Skip to content

Instantly share code, notes, and snippets.

@dreyescat
Created December 18, 2015 18:02
Show Gist options
  • Select an option

  • Save dreyescat/c3fd66ea0f7e97ba5c21 to your computer and use it in GitHub Desktop.

Select an option

Save dreyescat/c3fd66ea0f7e97ba5c21 to your computer and use it in GitHub Desktop.

Revisions

  1. dreyescat created this gist Dec 18, 2015.
    12 changes: 12 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <html>
    <head>
    </head>
    <body>
    <script src="lib/yourlib.js"></script>
    <script>
    window.onload = function () {
    EntryPoint.run();
    };
    </script>
    </body>
    </html>
    5 changes: 5 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    module.exports = {
    run: function () {
    console.log('run from library');
    }
    };
    12 changes: 12 additions & 0 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    {
    "name": "test-webpack-library",
    "version": "1.0.0",
    "description": "",
    "main": "./lib/yourlib.js",
    "scripts": {
    "build": "webpack"
    },
    "keywords": [],
    "author": "",
    "license": "MIT"
    }
    11 changes: 11 additions & 0 deletions webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    var webpack = require('webpack');

    module.exports = {
    entry: './index.js',
    output: {
    path: './lib',
    filename: 'yourlib.js',
    libraryTarget: 'var',
    library: 'EntryPoint'
    }
    };