Last active
December 6, 2018 09:36
-
-
Save movii/34cd5f59a5bace0ecebe4e7e572d3100 to your computer and use it in GitHub Desktop.
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
// 在 webpack.config.js 中通过 resolve.alias | |
// 预定义“目标文件夹”的 shortcut | |
module.exports = { | |
filename: 'bundle.js', | |
publicPath: 'http://localhost:1333/dist/' | |
}, | |
+ resolve:{ | |
+ alias: { | |
+ JS_ROOT: path.resolve(__dirname, 'src/'), | |
+ CSS_ROOT: path.resolve(__dirname, 'css/'), | |
+ SCSS_ROOT: path.resolve(__dirname, 'scss/') | |
+ } | |
+ }, | |
module: { | |
rules: [ | |
{ |
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
// 在任意入口文件中,通过预定义的名称 | |
// 快速定位目标依赖文件的位置 | |
import Vue from 'vue' | |
import App from './App.vue' | |
-import css from '../../scss/main.scss' | |
+import css from 'SCSS_ROOT/main.scss' | |
const app = new Vue({ | |
render: h => h(App) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment