将js文件添加到nuxt配置

webpack Vue.js

EvaA

2020-03-24

有人设计了我的网页的前端,现在我正在尝试对nuxtjs中的所有页面全局使用所有.css和.js文件。但是我无法正确包含文件。

这是我要包含的文件之一:jquery.themepunch.tools.min.js我收到此错误:

{ statusCode: 404, path: '/~/assets/revolution/js/jquery.themepunch.tools.min.js', message: 'This page could not be found' }

我将文件的路径添加到我的nuxt.js.config中,但是我无法弄清楚这里缺少什么。这是我的配置文件:

const webpack = require('webpack')

module.exports = {
  head: {
    title: 'test-webpage',

    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: 'test page' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ],
    script: [
      {src: '~/assets/revolution/js/jquery.themepunch.tools.min.js'}
    ]
  },

  build: {
    vendor: ['jquery', 'bootstrap'],
    plugins: [
      // set shortcuts as global for bootstrap
      new webpack.ProvidePlugin({
        $: 'jquery',
        jQuery: 'jquery',
        'window.jQuery': 'jquery'
      })
    ]
  },
}

第3391篇《将js文件添加到nuxt配置》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点

0个回答

问题类别

JavaScript Ckeditor Python Webpack TypeScript Vue.js React.js ExpressJS KoaJS CSS Node.js HTML Django 单元测试 PHP Asp.net jQuery Bootstrap IOS Android