Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Commit

Permalink
Use resolve.alias to resolve the problem
Browse files Browse the repository at this point in the history
  • Loading branch information
vtabary committed Dec 14, 2016
1 parent d9f9c46 commit 0db6bd6
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
6 changes: 6 additions & 0 deletions config/webpack.config.dllreferenceplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ module.exports = webpackMerge(commonConfig, {
'main': ['./src/final/index']
},

resolve: {
alias: {
'mydll': path.resolve(path.join(__dirname, '../src/dll/index.js'))
}
},

plugins: [
new webpack.DllReferencePlugin({
context: '.',
Expand Down
2 changes: 1 addition & 1 deletion example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Webpack umd / dllplugin</title>
<title>Webpack require dllname</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "webpack-require-dllname",
"version": "1.0.0",
"description": "",
"main": "index.js",
"main": "./src/dll/index.js",
"engine": {
"node": ">=6 <7",
"npm": "> 3"
Expand Down Expand Up @@ -36,9 +36,7 @@
"webpack-merge": "^1.0.2"
},
"dependencies": {
"@angular/core": "2.2.1",
"rxjs": "5.0.0-beta.12",
"systemjs": "^0.19.41",
"zone.js": "0.6.21"
"whatwg-fetch": "^2.0.1"
}
}
5 changes: 5 additions & 0 deletions src/dll/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
test: function (name) {
alert(`Hello ${name} !`);
}
};
6 changes: 2 additions & 4 deletions src/dll/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const Component = require('@angular/core').Component;
const fetch = require('whatwg-fetch');

module.exports = function test (name) {
alert(`Hello ${name} !`);
};
module.exports = require('./code');
2 changes: 1 addition & 1 deletion src/final/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Component = require('@angular/core').Component;
const fetch = require('whatwg-fetch');
const test = require('mydll').test;

test('world');

0 comments on commit 0db6bd6

Please sign in to comment.