0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Webpackerのメモ

Posted at

Webpacker周りのメモを書いていく。

environmentのデフォルトの中身

Environment {
  loaders:
    Map {
      'babel' => { 
        test: /\.(js|jsx)?(\.erb)?$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
        options: [Object]
      },
      'coffee' => {
        test: /\.coffee(\.erb)?$/, loader: 'coffee-loader'
      },
      'elm' => {
        test: /\.elm(\.erb)?$/,
        exclude: [Array],
        loader: 'elm-hot-loader!elm-webpack-loader?cwd=/Users/eijiosakabe/Documents/data/my_pg/my_project/idol_calendar&pathToMake=/Users/eijiosakabe/Documents/data/my_pg/my_project/idol_calendar/node_modules/.bin/elm-make&verbose=true&warn=true&debug=true'
      },
      'erb' => {
        test: /\.erb$/,
        enforce: 'pre',
        exclude: /node_modules/,
        loader: 'rails-erb-loader',
        options: [Object]
      },
      'file' => {
        test: /\.(jpg|jpeg|png|gif|svg|eot|otf|ttf|woff|woff2)$/i,
        use: [Array]
      },
      'style' => {
        test: /\.(scss|sass|css)$/i, use: [Array]
      },
      'typescript' => {
        test: /\.(ts|tsx)?(\.erb)?$/, loader: 'ts-loader'
      },
      'vue' => {
        test: /\.vue(\.erb)?$/,
        loader: 'vue-loader',
        options: [Object]
      }
    },
  plugins:
    Map {
      'Environment' => EnvironmentPlugin { keys: [Array], defaultValues: [Object] },
      'ExtractText' => ExtractTextPlugin { filename: '[name]-[contenthash].css', id: 1, options: {} },
      'Manifest' => ManifestPlugin { opts: [Object] }
    }
}

public/assets以下の静的ファイルが404になる

おそらくwebpackerとasset pipelineを同時に使おうとしている場合になるぽい。
正確な原因はわからなかったが、解決策はwebpackerのoutput_pathとasset pipelineのoutput_pathが同じ"assets"であったため。
webpackerの方を"packs"に変えたら問題なくファイルを返すようになった。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?