adobe-fonts / source-code-pro

Monospaced font family for user interface and coding environments
https://adobe-fonts.github.io/source-code-pro/
SIL Open Font License 1.1
19.85k stars 1.62k forks source link

[error] font in vue . #238

Closed 625781186 closed 4 years ago

625781186 commented 4 years ago

import css : image

webpack : image

image

error : image


Env : "css-loader": "^3.4.2", "file-loader": "^5.1.0", "webpack": "^4.42.0", Webpack :

'use strict';
const path = require("path");

const HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin');

const config          = {
    dev : {
        mode           : 'development',
        assetsPublcPath: '/',
    },
    prod: {
        mode           : 'production',
        index          : path.resolve(__dirname, "../dist/index.html"),
        assetsPublcPath: path.resolve(__dirname, "../dist"),
    },
}

function resolve(dir) {
    return path.join(__dirname, '..', dir)
}

// console.log(process.env.NODE_PATH)

module.exports = {
    mode   : 'development',
    context: path.resolve(__dirname, '../'),
    entry  : {
        app: './src/main.js',
    },
    output : {
        filename: '[name].bulde.[hash:10].js',
        path    : config.dev.assetsPublcPath,
    },
    module : {
        rules: [
            {
                test  : /\.vue$/,
                loader: 'vue-loader',

            },
            {
                test  : /\.(eot|svg|ttf|woff|woff2|otf)(\?\S*)?$/,
                loader: 'file-loader',
            },
            {
                test: /\.css$/,
                use : ['style-loader',
                       'css-loader',
                ],
            },
            {
                test  : /\.styl$/,
                loader: ['style-loader',
                         'css-loader',
                         'stylus-loader',
                ],
            },
            {
                test   : /\.js$/,
                exclude: /node_modules/,
                loader : 'babel-loader',
                options: {
                    presets: ['babel-preset-env'],
                },
            },
        ],
    },
    plugins: [
        new HtmlWebpackPlugin({
            // 写入bundle的那个index.html
            filename: 'index.html',
            template: 'index.html',
        }),
        // make sure to include the plugin for the magic
        new VueLoaderPlugin(),

    ],
    resolve: {
        extensions: ['.js', '.jsx', '.css', '.less', '.json','vue'
        ],
        alias     : {
            'vue$': 'vue/dist/vue.esm.js',
            '@'   : resolve('src'),
        },

    },

};
625781186 commented 4 years ago

If I use <script src="http://use.edgefonts.net/source-code-pro.js"></script> , it's success, but I need run in local without network.

frankrolf commented 4 years ago

I don’t assume this is an issue with the font. Edge Web Fonts is not currently in active development. You may want to look at other options for serving Source Code Pro, such as Adobe Fonts or Google Fonts.