This repository was archived by the owner on Nov 5, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +56
-0
lines changed Expand file tree Collapse file tree 6 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ node_modules
Original file line number Diff line number Diff line change 1+ # script loader for webpack
2+
3+ ## Usage
4+
5+ ``` javascript
6+ require (" script!./file.js" );
7+ // => execute file.js once in global context
8+ ```
9+
10+ Does nothing in node.js.
11+
12+ ## License
13+
14+ MIT (http://www.opensource.org/licenses/mit-license.php)
Original file line number Diff line number Diff line change 1+ module . exports = function ( ) { }
Original file line number Diff line number Diff line change 1+ /*
2+ MIT License http://www.opensource.org/licenses/mit-license.php
3+ Author Tobias Koppers @sokra
4+ */
5+ module . exports = function ( src ) {
6+ if ( window . execScript )
7+ window . execScript ( src ) ;
8+ else
9+ eval . call ( null , src ) ;
10+ }
Original file line number Diff line number Diff line change 1+ /*
2+ MIT License http://www.opensource.org/licenses/mit-license.php
3+ Author Tobias Koppers @sokra
4+ */
5+ var path = require ( "path" ) ;
6+ module . exports = function ( content ) {
7+ var loaderSign = this . request . indexOf ( "!" ) ;
8+ var rawJs = this . request . substr ( loaderSign ) ; // including leading "!"
9+ if ( this . web )
10+ return "require(" + JSON . stringify ( path . join ( __dirname , "addScript" ) ) + ")" +
11+ "(require(" +
12+ JSON . stringify ( "raw" + rawJs ) + "))" ;
13+ return "" ;
14+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " script-loader" ,
3+ "version" : " 0.1.1" ,
4+ "author" : " Tobias Koppers @sokra" ,
5+ "description" : " script loader module for webpack" ,
6+ "dependencies" : {
7+ "raw-loader" : " 0.1.x"
8+ },
9+ "licenses" : [
10+ {
11+ "type" : " MIT" ,
12+ "url" : " http://www.opensource.org/licenses/mit-license.php"
13+ }
14+ ],
15+ "license" : " MIT"
16+ }
You can’t perform that action at this time.
0 commit comments