-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mogu
authored and
mogu
committed
Jul 29, 2020
1 parent
11562a2
commit b9a6308
Showing
6 changed files
with
248 additions
and
23 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const loaderUtils = require('loader-utils') | ||
|
||
module.exports = function(source) { | ||
const options = loaderUtils.getOptions(this) | ||
console.log('options', options) | ||
const result = source.replace('call', options.name) | ||
console.log('source', result) | ||
return result | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import './assets/index.css' | ||
import './assets/index.less' | ||
// import './assets/index.css' | ||
// import './assets/index.less' | ||
|
||
console.log('call mobar') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const path = require('path') | ||
|
||
module.exports = { | ||
mode: 'development', | ||
entry: { | ||
main: './src/main.js' | ||
}, | ||
output: { | ||
filename: '[name].js', | ||
path: path.resolve(__dirname, 'dist') | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
use: { | ||
loader: path.resolve(__dirname, './repalce-loader.js'), | ||
options: { | ||
name: 'cccc' | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} |
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