U
U
uuushka2017-01-26 17:29:12
JavaScript
uuushka, 2017-01-26 17:29:12

How to include images from node_modules in local assembly?

Hello!

var webpackBaseConfig = {
    devtool: 'eval-cheap-module-source-map',
    entry: entry(),
    output: {
        filename: "[name].js",
        path: path.resolve(__dirname, 'dist'),
        libraryTarget: "amd"
    },
    module: {
        loaders: [
            {test: /\.ts?$/, exclude: /node_modules/, loader: 'es3ify!ts'},
            {test: /\.(scss|css)(\?.+)?$/, loader: 'style-loader!css-loader!sass-loader?sourceMap'},
            {test: /\.svg|ico|png|gif|jpg($|\?)/, loader: 'file?name=images/[name].[ext]'},
            {test: /\.eot|ttf|woff|woff2($|\?)/, loader: 'file?name=fonts/[name].[ext]'}
        ]
    }, 
...
    resolve: {
        root: path.resolve(__dirname, "src"),
        alias: {
          images: path.resolve("./node_modules/inner-module/build/images")
        },
        extensions: ["", ".js", ".ts", ".css", ".scss", ".png"]
    },
.....
};

does not work
alias: {
          images: path.resolve("../node_modules/inner-module/build/images")
        },

what is the right way to write a config in order to collect pictures from a certain package in node_modules in addition to project pictures?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question