Compiling/importing 个来自资产文件夹的文件
Compiling/importing files from the assets folder
我目前在使用 vue.js
v2 的项目中工作,我花了 2 个小时试图 include/compile 资产文件夹中的一些文件,当我 npm run dev
或npm run build
它不包含我想要的文件,事实上它不包含资产文件夹中的任何 css/js 文件。
我如何以及在哪里指定(以正确的顺序)我想要导入的文件?
我按照documentation install,一切都是默认的
- my-project
- build
- config
- dist
- node_modules
- src
- assets
- css
- js
- plugins
- components
- router
- App.vue
- main.js
- static
通过在 webpack 配置中包含 jQuery
通过 webpack 模块解决了错误,这样他的 JavaScript 使用 jQuery 的文件可以全局加载到他的配置中。
https://webpack.github.io/docs/usage.html
alias: {
'src': path.resolve(__dirname, '../src'),
'assets': path.resolve(__dirname, '../src/assets'),
'components': path.resolve(__dirname, '../src/components'),
'jquery': path.resolve(__dirname, '../node_modules/jquery/src/jquery'),
'directives': path.resolve(__dirname, '../src/directives')
}
我目前在使用 vue.js
v2 的项目中工作,我花了 2 个小时试图 include/compile 资产文件夹中的一些文件,当我 npm run dev
或npm run build
它不包含我想要的文件,事实上它不包含资产文件夹中的任何 css/js 文件。
我如何以及在哪里指定(以正确的顺序)我想要导入的文件?
我按照documentation install,一切都是默认的
- my-project
- build
- config
- dist
- node_modules
- src
- assets
- css
- js
- plugins
- components
- router
- App.vue
- main.js
- static
通过在 webpack 配置中包含 jQuery
通过 webpack 模块解决了错误,这样他的 JavaScript 使用 jQuery 的文件可以全局加载到他的配置中。
https://webpack.github.io/docs/usage.html
alias: {
'src': path.resolve(__dirname, '../src'),
'assets': path.resolve(__dirname, '../src/assets'),
'components': path.resolve(__dirname, '../src/components'),
'jquery': path.resolve(__dirname, '../node_modules/jquery/src/jquery'),
'directives': path.resolve(__dirname, '../src/directives')
}