webpack - require ('node_modules / leaflet / leaflet.css')

So versuche ich, eine Karten-App mit @ zu erstellwebpack undleaflet. Ich kann @ verlangleaflet.js Von meinemmap.js -Datei, aber ich kann leaflet.css nicht aufrufen, ohne eine Fehlermeldung zu erhalten.

Meine jetzigewebpack.config.js sieht aus wie

'use strict'

var webpack = require('webpack'),
    path = require('path'),
    HtmlWebpackPlugin = require('html-webpack-plugin'),
    srcPath = path.join(__dirname, 'src');

module.exports = {
    target: "web",
    cache: true,
    entry: {
        app: path.join(srcPath, "index.js")
    },
    resolve: {
        alais: {
            leaflet_css: __dirname + "/node_modules/leaflet/dist/leaflet.css"
        }
    },
    module: {
        loaders: [
          {test: /\.js?$/, exclude: /node_modules/, loader: "babel-loader"},
          {test: /\.scss?$/, exclude: /node_modules/, loader: "style!css!sass!"},
          {test: /\.css?$/, loader: "style!css!"}
        ]
    },
    plugins: [
        new webpack.optimize.CommonsChunkPlugin("common", "common.js"),
        new HtmlWebpackPlugin({
          inject: true,
          template: "src/index.html"
        }),
        new webpack.NoErrorsPlugin()
      ],
    output: {
        path: path.join(__dirname, "dist"),
        publicPath: "/dist/",
        filename: "[name].js",
        pathInfo: true
    }
}

Und meinmain.js Datei sieht so aus:

var $ = require('jquery'),
    leaflet = require('leaflet');

require("./sass/main.scss");
require("leaflet_css");

var map = L.map('map').setView([51.505, -0.09], 13);

L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

L.marker([51.5, -0.09]).addTo(map)
    .bindPopup('A pretty CSS3 popup.<br> Easily customizable.')
    .openPopup();

console.log('I got called');

Was ist der richtige Ansatz, um CSS-Dateien von Drittanbietern über das Webpack zu bündeln?

Ich sahdieses Projek wurdenleaflet wird im libs-Verzeichnis gespeichert ... was ist der Grund dafür, warum es im @ speichelibs -Verzeichnis, wenn es im @ installiert inode_modules Verzeichnis vianpm?

Dies ist sehr viel eine Lernübung, so dass alle Hinweise sehr geschätzt werden! :)

Antworten auf die Frage(4)

Ihre Antwort auf die Frage