webpack错误:Entry module not found: Error: Can't resolve 'babel-loader' in


64x64
匿名 2017-10-30 22:59 617

在命令行窗口运行webpack命令,出现错误:“ERROR in Entry module not found: Error: Can't resolve 'babel-loader' in.........”

webpackwebviewvue 回答问题

2 个解决方案


1
匿名 2017-10-30T23:02:53

没有安装babel-loader模块,使用 npm install babel-loader --save 安装模块,如果还出现其实模块缺失再安装对应模块,

如:Module build failed: Error: Cannot find module 'babel-core',再安装 npm install babel-core --save


2
等待青春 2017-11-05T23:17:56

使用反射的方式修改webview允许跨域

package com.example.weinre;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.webkit.WebView;

public class MyWebView extends WebView {

    public MyWebView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        // TODO Auto-generated constructor stub
    }

    public MyWebView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyWebView(Context context) {
        super(context);
    }

    public void enablecrossdomain() {
        try {
            Field field = WebView.class.getDeclaredField("mWebViewCore");
            field.setAccessible(true);
            Object webviewcore = field.get(this);
            Method method = webviewcore.getClass().getDeclaredMethod(
                    "nativeRegisterURLSchemeAsLocal", String.class);
            method.setAccessible(true);
            method.invoke(webviewcore, "http");
            method.invoke(webviewcore, "https");
        } catch (Exception e) {
            Log.d("custom webview", "enablecrossdomain error");
            e.printStackTrace();
        }
    }

    public void enablecrossdomain41() {
        try {
            Field webviewclassic_field = WebView.class
                    .getDeclaredField("mProvider");
            webviewclassic_field.setAccessible(true);
            Object webviewclassic = webviewclassic_field.get(this);
            Field webviewcore_field = webviewclassic.getClass()
                    .getDeclaredField("mWebViewCore");
            webviewcore_field.setAccessible(true);
            Object mWebViewCore = webviewcore_field.get(webviewclassic);
            Field nativeclass_field = webviewclassic.getClass()
                    .getDeclaredField("mNativeClass");
            nativeclass_field.setAccessible(true);
            Object mNativeClass = nativeclass_field.get(webviewclassic);

            Method method = mWebViewCore.getClass().getDeclaredMethod(
                    "nativeRegisterURLSchemeAsLocal",
                    new Class[] { int.class, String.class });
            method.setAccessible(true);
            method.invoke(mWebViewCore, mNativeClass, "http");
            method.invoke(mWebViewCore, mNativeClass, "https");
        } catch (Exception e) {
            Log.d("custom webview", "enablecrossdomain error");
            e.printStackTrace();
        }
    }

}

调用设置:  

 webview.enablecrossdomain41();
settings.setAllowUniversalAccessFromFileURLs(true)  


评论