FrozenPandaz / ng-universal-demo

171 stars 54 forks source link

Problem with assets folder #22

Closed Dragons0458 closed 7 years ago

Dragons0458 commented 7 years ago

Hi! How can I export the assets folder to the dist folder? Thank you!

ysus commented 7 years ago

inside the webpack.common.js add the follow plugin const SRC_DIR = join(process.cwd(), 'src'); new CopyWebpackPlugin([{ from: join(SRC_DIR, 'assets'), to: 'assets' }])

Dragons0458 commented 7 years ago

Hello man! Works perfectly, thank you very much, this is the final file in case someone else needs it:

const {root} = require('./helpers');
const CopyWebpackPlugin = require("copy-webpack-plugin");

/**
 * This is a common webpack config which is the base for all builds
 */
module.exports = {
  devtool: 'source-map',
  resolve: {
    extensions: ['.ts', '.js']
  },
  output: {
    path: root('dist')
  },
  module: {
    rules: [
      {test: /\.ts$/, loader: '@ngtools/webpack'},
      {test: /\.css$/, loader: 'raw-loader'},
      {test: /\.html$/, loader: 'raw-loader'}
    ]
  },
  plugins: [new CopyWebpackPlugin([{from: root('src/assets'), to: 'assets'}])]
};